5
$\begingroup$

I'm trying to keep track of pairs of points when they are represented. For a set of pair of points like:

newx = {{{0.135104, 0.424232}, {0.0700024, 0.464537}}, {{0.968525, 
   0.346787}, {0.822588, 0.884112}}, {{0.908807, 0.389676}, {0.698018,
    0.815693}}, {{0.465015, 0.805677}, {0.268573, 
   0.857867}}, {{0.747337, 0.788575}, {0.497344, 
   0.893726}}, {{0.355489, 0.987499}, {0.197186, 
   0.989964}}, {{0.183918, 0.282062}, {0.0966277, 
   0.351434}}, {{0.749388, 0.361435}, {0.499389, 0.680327}},[![enter image description here][1]][1]   {{0.277621, 
   0.191408}, {0.150071, 0.312754}}, {{0.513538, 0.867554}, {0.302532,
    0.907623}}}

I plot them (with a diagonal line, not important):

ListPlot[newx, PlotRange -> {{0, 1}, {0, 1}}];

enter image description here

In case of having small number of pairs, I can identify them visually, but having a large number of them is problematic.

Any idea about how to identify pairs of points?

$\endgroup$
6
$\begingroup$

One possibility would be to connect like-colored dots with lines:

Show[ListPlot[newx, PlotRange -> {{0, 1}, {0, 1}}], Graphics[Line /@ newx]]

enter image description here

$\endgroup$
9
$\begingroup$

You can also use ListLinePlot with the option PlotMarkers:

ListLinePlot[newx, 
 PlotRange -> {{0, 1}, {0, 1}}, 
 PlotStyle -> Dotted, 
 PlotMarkers -> {Automatic, 14}, 
 PlotLegends -> Placed[MatrixForm /@ newx, Right], 
 AspectRatio -> 1, 
 Frame -> True,
 ImageSize -> 500]

enter image description here

Alternatively,

colors = ColorData["Rainbow"] /@ Subdivide[Length@newx - 1]; 

Graphics[MapThread[{Opacity[.2, #],  
    CapForm["Round"], AbsoluteThickness[15], Line@#2, Opacity[1], #, 
    AbsolutePointSize[7], Point @ #2} &, {colors, newx}], Frame -> True]

enter image description here

You can also put pairs in separate blobs (similar to community regions in CommunityGraphPlot):

ClearAll[blobS]
blobS = Module[{}, CommunityGraphPlot[{}]; 
  GraphComputation`GraphCommunitiesPlotDump`generateBlobs[Automatic, {#}, .01][[2, 1]]]&;

Example:

SeedRandom[1]
colors = RandomColor[Length@newx];

Graphics[MapThread[{Darker @ #, PointSize[Large], Point @ #2, 
    Opacity[.5, Lighter @ #], EdgeForm[Gray], blobS @ #2} &, 
    {colors, newx}], 
  Frame -> True]

enter image description here

$\endgroup$
1
$\begingroup$
newx = {
   {{0.135104, 0.424232}, {0.0700024, 0.464537}},
   {{0.968525, 0.346787}, {0.822588, 0.884112}},
   {{0.908807, 0.389676}, {0.698018, 0.815693}},
   {{0.465015, 0.805677}, {0.268573, 0.857867}},
   {{0.747337, 0.788575}, {0.497344, 0.893726}},
   {{0.355489, 0.987499}, {0.197186, 0.989964}},
   {{0.183918, 0.282062}, {0.0966277, 0.351434}},
   {{0.749388, 0.361435}, {0.499389, 0.680327}}, 
   {{0.277621, 0.191408}, {0.150071, 0.312754}},
   {{0.513538, 0.867554}, {0.302532, 0.907623}}};

Manipulate[
 ListPlot[newx,
  PlotRange -> {{0, 1}, {0, 1}},
  PlotStyle -> ReplacePart[
    ConstantArray[Automatic, Length[newx]],
    pair -> AbsolutePointSize[10]]],
 {{pair, 1, "Pair"}, Range[Length[newx]],
  ControlType -> PopupMenu}]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.