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

**URL:** https://discourse.julialang.org/t/change-distance-between-dots-in-linestyle-dot-plotting-option/86592
**Category:** Visualization
**Created:** [August 31, 2022, 11:42am UTC](https://discourse.julialang.org/t/change-distance-between-dots-in-linestyle-dot-plotting-option/86592 "2022-08-31T11:42:41Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Torkel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/torkel/32/5030_2.png) [@Torkel](https://discourse.julialang.org/u/Torkel)
#### Post date: [August 31, 2022, 11:42am UTC](https://discourse.julialang.org/t/change-distance-between-dots-in-linestyle-dot-plotting-option/86592/1 "2022-08-31T11:42:41Z")

</div>

I am plotting something like:

```julia
plot(x->x^2,lw=5,linestyle=:dot)

```

![image](https://global.discourse-cdn.com/julialang/original/3X/c/7/c73ca2c755d5b10ce01e6dc89adeb7d66fceb541.png)

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

---

<div class="post-metadata">

### Author: ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)
#### Post date: [August 31, 2022, 12:18pm UTC](https://discourse.julialang.org/t/change-distance-between-dots-in-linestyle-dot-plotting-option/86592/2 "2022-08-31T12:18:30Z")

</div>

A ridiculous workaround to make it denser:

```julia
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)

```

 ![Plots_gr_denser_dotted_lines](https://global.discourse-cdn.com/julialang/original/3X/6/0/606722c4452f1601fa9dd8e48de256f8ae62301a.png)

---

<div class="post-metadata">

### Author: ![Ashlin\_Harris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ashlin_harris/32/210166_2.png) [@Ashlin\_Harris](https://discourse.julialang.org/u/Ashlin_Harris)
#### Post date: [August 31, 2022, 2:03pm UTC](https://discourse.julialang.org/t/change-distance-between-dots-in-linestyle-dot-plotting-option/86592/3 "2022-08-31T14:03:57Z")

</div>

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:  
 ![plot](https://global.discourse-cdn.com/julialang/original/3X/f/6/f64db2222335eefd6cc41cf18aea2c9f5ac9afa9.png)

---

<div class="post-metadata">

### Author: ![ThummeTo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thummeto/32/26105_2.png) [@ThummeTo](https://discourse.julialang.org/u/ThummeTo)
#### Post date: [June 6, 2023, 6:49am UTC](https://discourse.julialang.org/t/change-distance-between-dots-in-linestyle-dot-plotting-option/86592/4 "2023-06-06T06:49:26Z")

</div>

I have the same problem (for dots as well as for dashes). Is there no parameter to adjust the space between dots/dashes? Basically `:dot` generates a line with dots with no space at all for me. Adjusting the linewidth does also affect the dot spacing, but (of course) dots become larger too which is not what I want.

Thanks in advance!

---

<div class="post-metadata">

### Author: ![sijo](https://avatars.discourse-cdn.com/v4/letter/s/da6949/32.png) [@sijo](https://discourse.julialang.org/u/sijo)
#### Post date: [June 6, 2023, 7:15am UTC](https://discourse.julialang.org/t/change-distance-between-dots-in-linestyle-dot-plotting-option/86592/5 "2023-06-06T07:15:09Z")

</div>

Not sure abouts Plots but with Makie you can pass a vector of lenghts as linestyles, see [lines · Makie](https://docs.makie.org/stable/examples/plotting_functions/lines/index.html#linestyles)

---

<div class="post-metadata">

### Author: ![BeastyBlacksmith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/beastyblacksmith/32/4741_2.png) [@BeastyBlacksmith](https://discourse.julialang.org/u/BeastyBlacksmith)
#### Post date: [June 6, 2023, 8:16am UTC](https://discourse.julialang.org/t/change-distance-between-dots-in-linestyle-dot-plotting-option/86592/6 "2023-06-06T08:16:33Z")

</div>

The short answer is: no, noone implemented this yet. Someday someone might have enough need to do it, but that day isn’t today.

Although with [Add extra series options at the end by BeastyBlacksmith · Pull Request #4765 · JuliaPlots/Plots.jl · GitHub](https://github.com/JuliaPlots/Plots.jl/pull/4765) it can be set via extra keywords for the pgfplotsx backend.

---

<div class="post-metadata">

### Author: ![ThummeTo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thummeto/32/26105_2.png) [@ThummeTo](https://discourse.julialang.org/u/ThummeTo)
#### Post date: [June 6, 2023, 1:14pm UTC](https://discourse.julialang.org/t/change-distance-between-dots-in-linestyle-dot-plotting-option/86592/7 "2023-06-06T13:14:36Z")

</div>

Thanks!
