# Cannot change linestyle of line using attributes.linestyle in GLMakie

**URL:** <https://discourse.julialang.org/t/cannot-change-linestyle-of-line-using-attributes-linestyle-in-glmakie/111561>\
**Category:** Visualization\
**Tags:** question, glmakie\
**Created:** [March 13, 2024, 10:47am UTC](https://discourse.julialang.org/t/cannot-change-linestyle-of-line-using-attributes-linestyle-in-glmakie/111561 "2024-03-13T10:47:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![oniehuis](https://avatars.discourse-cdn.com/v4/letter/o/ecc23a/32.png) [@oniehuis](https://discourse.julialang.org/u/oniehuis)\
**Post date:** [March 13, 2024, 10:47am UTC](https://discourse.julialang.org/t/cannot-change-linestyle-of-line-using-attributes-linestyle-in-glmakie/111561/1 "2024-03-13T10:47:21Z")

</div>

I want to change some attributes of lines that have already been drawn. I can change the color and line width by overwriting the values of line attributes.color and attributes.linewidth. However, I cannot change the line style by assigning a new value to line attributes.linestyle: whenever a new valid line style symbol is assigned, it throws the “ERROR: cannot convert a value to nothing for assignment”. Am I doing something wrong, or is this a bug, possibly related to the one I reported in an earlier post ([Cannot set linestyle to :solid with observable using GLMakie](https://discourse.julialang.org/t/cannot-set-linestyle-to-solid-with-observable-using-glmakie/111413))?

Here is code that illustrates the problem when running Julia v1.10.2 and GLMakie v0.9.9:

```julia
using GLMakie

f = Figure()
ax = Axis(f[1, 1])
display(f)

l = lines!(ax, 1:100, rand(100), color=:blue, linewidth=1, linestyle=:solid)

l.attributes.linewidth = 3
l.attributes.color = :red
l.attributes.linestyle = :dash # also throws an error when assigning :dot, :dashdot, :dashdotdot, but not when assigning :solid

```

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [March 13, 2024, 11:28am UTC](https://discourse.julialang.org/t/cannot-change-linestyle-of-line-using-attributes-linestyle-in-glmakie/111561/2 "2024-03-13T11:28:24Z")

</div>

I think fixing the other bug would probably also fix this one

---

<div class="post-metadata">

**Author:** ![oniehuis](https://avatars.discourse-cdn.com/v4/letter/o/ecc23a/32.png) [@oniehuis](https://discourse.julialang.org/u/oniehuis)\
**Post date:** [March 15, 2024, 7:43am UTC](https://discourse.julialang.org/t/cannot-change-linestyle-of-line-using-attributes-linestyle-in-glmakie/111561/3 "2024-03-15T07:43:47Z")

</div>

Thank you for your feedback!
