Skip to main content

plotting - Is it Possible to change dashes into circles with Plot command?


Is it possible to change the Dashed Style of a curve into circles with Plot command ?


Plot[Cos[x], {x, 0, 2*Pi}, PlotStyle -> Directive[Dashed, Thickness[0.005]]]

enter image description here



Answer



Perhaps this approach, using Mesh, MeshStyle, and Opacity, will give you what you looking for.



Plot[Cos[x], {x, 0, 2 Pi},
PlotStyle -> {Opacity[0]}, Mesh -> 50, MeshStyle -> {PointSize[Medium]}]

plot.png


Update


To show two curves, one as dots and the other as a normal plot, I would make two plots and combine them with Show.


p1 = 
Plot[Cos[x], {x, 0, 2 Pi},
PlotStyle -> {Opacity[0]}, Mesh -> 30, MeshStyle -> {PointSize[Large], Blue}];
p2 = Plot[Sin[x], {x, 0, 2 Pi}, PlotStyle -> {Thick, Blue}];

Show[{p1, p2}]

show.png


You can use Show to combine as many plots as you wish.


Comments