Let's say I have a listplot like so:
ListPlot[Prime[Range[25]]]
I want my plot to mark the x,y values for the values associated with say, the 5th, and 10th points in the input. I would be interested in any of the following:
- marking simply the y values so have 11 and 29 in the y axis
- marking both x and y axis: ie show {5,11} and {10,29} in the x and y axis respectively.
with, or without perpendicular lines connecting the points to axes.
The point of this, is to give the reader of the plot, a sense of scale for given points of interest.
Do I have to superimpose different plots on each other or can I do it by some config on the listplot itself?
Ticks
? For example:ListPlot[Prime[Range[25]], Ticks -> {{5, 10}, Prime[{5, 10}]}, Epilog -> {Gray, Dashed, Line[{{5, 0}, {5, Prime[5]}}], Line[{{10, 0}, {10, Prime[10]}}], Line[{{0, Prime[5]}, {5, Prime[5]}}], Line[{{0, Prime[10]}, {10, Prime[10]}}] }]
$\endgroup$With[{points = {5, 10, 13}}, ListPlot[Prime[Range[25]], Ticks -> {points, Prime[points]}, Epilog -> {Gray, Dashed, {Line[{{#, 0}, {#, Prime[#]}}], Line[{{0, Prime[#]}, {#, Prime[#]}}]} & /@ points }]]
$\endgroup$