# Adding vertical dotted lines to a plot with different markers as dots

Based on this answer I am able to draw dotted or dashed vertical lines in a plot using Epilog. For example (from the answer I linked)

f[x_] := (x^2 z)/((x^2 - y^2)^2 + 4 q^2 x^2) /. {y -> π/15, z -> 1, q -> π/600}
Quiet[maxy = FindMaxValue[f[x], x]*1.1]
lineStyle = {Thick, Red, Dashed};
line1 = Line[{{π/15 + 1/50, 0}, {π/15 + 1/50, maxy}}];
line2 = Line[{{π/15 - 1/50, 0}, {π/15 - 1/50, maxy}}];
Plot[{f[x]}, {x, π/15 - 1/20, π/15 + 1/20},
PlotStyle -> {Automatic},
Epilog -> {Directive[lineStyle], line1, line2}] Now, what I'd like to do is not plot dashed lines, but plot lines that are essentially dotted with a certain marker, such as a Disk or a Rectangle, or even a Polygon. Is there a way to do this? I've looked into Dashing, but I don't really see any marker options there.

A rough mockup would be something like this While I don't disagree with the comments that there might be better solutions in terms of how one represents data properly, it would still be nice to be able to try.

• @Kuba I don't really see how that would work. Make 20+ little arrows (with different heads) and put them at small increments from each other vertically? – user129412 Aug 11 '16 at 11:11
• Graphics[{Arrowheads[{.1, #, Graphics[{Black, Circle[]}]} & /@ Range[0, 1, .1]], White, Arrow[{{0, 0}, {2, 1}}]}] more or less, just a tip. You can also use LineScaledCoordinate to generate positions along lines and put whatever you need there with Inset. – Kuba Aug 11 '16 at 11:20
• I see, I'll give that some thought! – user129412 Aug 11 '16 at 11:24
• Why are you trying to do this? It violates the canons of good visual design. Surely the data is more important than the two vertical lines, so you should not draw more attention to the lines than to the data itself. – m_goldberg Aug 11 '16 at 12:34
• Good point! I'm trying to think of how to explain it without getting into the specifics. I have a set of curves (say 6) in frequency space (x-axis); they are the main objects of interest, indeed. They have a legend and are color coded. But they occur because we excite some atom with a laser at certain frequencies, and these exact frequencies I want to indicate with vertical gray dashed lines. Each laser has a different name however, so I would like to link the names of each laser to the symbol used for the 'dash-marker' of that gray line. – user129412 Aug 11 '16 at 13:02

The easiest way to do it would be to have a second ListPlot in the background, and you can use the PlotMarkers option.

f[x_] := (x^2 z)/((x^2 - y^2)^2 + 4 q^2 x^2) /. {y -> \[Pi]/15,
z -> 1, q -> \[Pi]/600}
Quiet[maxy = FindMaxValue[f[x], x]*1.1];

plotmarkers = GraphicsPlotMarkers[]
line1 = {1/50 + \[Pi]/15, #} & /@ Subdivide[0, maxy, 20];
line2 = {-(1/50) + \[Pi]/15, #} & /@ Subdivide[0, maxy, 20];
Show[
Plot[{f[x]}, {x, \[Pi]/15 - 1/20, \[Pi]/15 + 1/20},
PlotRange -> All,
PlotLegends -> {"plot"}],
ListPlot[{line1, line2}, PlotMarkers -> plotmarkers[[{3, 5}]],
PlotLegends -> {"line 1", "line 2"}]
]
` 