Change distance between dots in `linestyle=:dot` plotting option

I am plotting something like:



Is there some way to modify the distance between the individual dots in the plot?

A ridiculous workaround to make it denser:

using Plots; gr()
x1, x2, dx = -2, 2, 0.1
plot(x->x^2, x1:dx:x2, c=:blue, lw=3, ls=:dot)
d = (x2 - x1)/55 / 5.5  # fudge factor (depends on line width)
plot!(x->x^2, (x1 + d):dx:(x2 + d), c=:blue, lw=3, ls=:dot)

1 Like

One option is to reduce the line width, since the smaller dots will be packed in more tightly.

Do you mind posting a full example? I get a slightly different result when I run your code: