1
$\begingroup$

I have two sequences of numbers, for example

A={0, 1/5, 1/4, 1/3, 2/5, 1/2, 3/5, 2/3, 3/4, 4/5, 1}

B={0, 1/10, 1/5, 3/10, 2/5, 1/2, 3/5, 7/10, 4/5, 9/10, 1}

and I want a diagram or graphic to join first term from A to first of B, i.e. {0,0}, the second of A to the second of B,... up to {1,1}. Also if possible I like to have bold point in the vertices joining each pairs.

I put here example did with MS paint.

enter image description here

$\endgroup$

1 Answer 1

1
$\begingroup$
a = Thread[{A, 0}];
b = Thread[{B, 1}];

ListLinePlot[Transpose[{a, b}], PlotStyle -> Thick, Joined -> True, 
 Epilog -> {PointSize[Medium], Point /@ {a, b}}]

enter image description here

ListLinePlot[Transpose[{a, b}], PlotStyle -> Thick, Joined -> True, 
 Epilog -> {EdgeForm[Gray], White, Disk[#, Offset[5]] & /@ Join[a, b]}, 
 Frame -> True, AspectRatio -> 1/5, PlotRangePadding -> {{.05, .05}, {.1, .1}}]

enter image description here

Alternatively, you can use Graphics:

Graphics[{Thick, MapIndexed[{ColorData[97]@#2[[1]], Line@#} &, Transpose[{a, b}]], 
  EdgeForm[Gray], White, Disk[#, Offset[5]] & /@ Join[a, b]}, 
 AspectRatio -> 1/5, Frame -> True, 
 PlotRangePadding -> {{.05, .05}, {.2, .2}}, ImageSize -> Large]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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