# Manipulating horizontal and vertical 'guidelines'

Is it possible to create an interactive plot that has drag-down / across horizontal & vertical guides a la Illustrator / InDesign?

I would like to generate something like this:

I would ideally like to drag multiple (unlimited?) horizontal and vertical guide lines, which would then stay in the positions that they are left in.

In addition (if it is not asking too much!) I would really like the guidelines to 'snap' to integers as well.

I have looked at various locator manipulations, with no success. Apologies for not including my Mathematica coding effort, but I don't really know where to start with this one :/

-
LocatorPane allows you to interactively add or remove Locators. – Sjoerd C. de Vries Nov 20 '13 at 10:59

Cheap and cheerful:

Manipulate[
Column[
{Round[xguide, 2],
Plot[{PrimePi[x]},
{x, 0, 200},
PlotPoints -> 200,
ImageSize -> 600,
Epilog -> {Gray,
Line[{{Round[xguide[[1]], 2], -1000}, {Round[xguide[[1]], 2],
1000}}],
Line[{{-1000, Round[ xguide[[2]], 2]}, {1000,
Round[xguide[[2]], 2]}}]
}]
}],
{{xguide, {20, 20}}, Locator, Appearance -> None}]


I'll leave you to explore the unlimited guides option... :)

-
@ Cormullion, great! thanks - gets me part way there ;) – martin Nov 20 '13 at 10:46
Added 1/2 to Round[xguide[[2]] + 0.5, 1] & seems to 'snap' to plot points ok now :) – martin Nov 20 '13 at 11:05
The rounding to 2 was only to make you notice Round. :) I had thought of decreasing the rounding strength as it approached the plotted line, but I got distracted... – cormullion Nov 20 '13 at 13:39