Heike gave an absolutely wonderful answer to my question about arranging subplots around a main plot and including connector lines. This is the result:
Starting from Heike's answer, what is the best order to arrange the subplots in so the connector lines are as easy to follow / as aesthetically arranged as possible?
To have something concrete to test with, let's say we have 12 points in the unit square. These are the starting points of the lines.
start = RandomReal[1, {12, 2}];
The set of endpoints is fixed (due to the subplot positions):
end = With[{dx = 0.1, dy = 0.1},
{{-dx, 1 + dy}, {.25 - dx/4, 1 + dy}, {.75 + dx/4, 1 + dy},
{1 + dx, 1 + dy}, {1 + dx, .75 + dy/4}, {1 + dx, .25 - dx/4},
{1 + dx, -dy}, {.75 + dx/4, -dy}, {.25 - dx/4, -dy},
{-dx, -dy}, {-dx, .25 - dy/4}, {-dx, .75 + dy/4}}];
Then the plot will look similar to this:
Graphics[{
FaceForm[Lighter@Orange], Polygon[{{0, 0}, {1, 0}, {1, 1}, {0, 1}}],
Line@Transpose[{start, end}],
AbsolutePointSize[18], Lighter@Orange, Point[end],
Black, MapThread[Text, {Range[12], end}]},
Frame -> True, FrameTicks -> None, PlotRange -> {{-.2, 1.2}, {-.2, 1.2}}]
Given the starting points in the orange square, how can we automatically reorder the labelled endpoints so the lines cross as little as possible (or generally: the figure looks as good as possible)?
Please try to make your answers complete, with a sample output figure using the code above. When it is not possible to avoid that the lines cross, what the "best" arrangement is is admittedly somewhat subjective.
Note: This is a question that I thought others would be interested in too. It is not a practical problem I am facing (I ordered the subplots manually in my figure), but of course if there are any good solutions, I will use them. I will be working on solutions as well.
Note 2: Given two lists, l1
and l2
, containing the same elements in different orders, the permutation that re-orders l1
to l2
is Part[Ordering[l1], Ordering@Ordering[l2]]
. This may be useful for reordering points.