New answers tagged

6

Here is an approach that tries to shuffle the points to form lines that are as straight as possible: SeedRandom[3]; (* some random data *) data = Map[RandomSample]@ Transpose@ Table[Evaluate@Sum[RandomReal[{-1, 1}] #^n, {n, 0, 2, 0.5}] & /@ Subdivide[50], {i, 25}]; Monitor[ (* show the current state of the points *) data = Sort/@data; (* ...


6

The issue is not styling, but the fact that the sort order used by Sort does not correspond to numerical ordering here: Sort[{10 Pi, Pi^2}] (* Out: {10 π, π^2} *) You can explicitly sort by numerical value using SortBy: SortBy[{10 Pi, Pi^2}, N] (* Out: {π^2, 10 π} *) So in your case: SortBy[Join[R, B], N]


8

RB = R~Join~B; NumericalSort[RB] An alternative, slightly longer, solution could be: RB = R~Join~B; order = Ordering[N@RB[[;;,1]]]; RB[[order]] With the same output as above. This can be convenient when the style of the two lists is different (as in comment below, one might be Bold while the other isn't): slicing the combined list when finding the ...


Top 50 recent answers are included