# Increase legend color dash thickness?

**URL:** <https://discourse.julialang.org/t/increase-legend-color-dash-thickness/49179>\
**Category:** New to Julia\
**Created:** [October 28, 2020, 2:43pm UTC](https://discourse.julialang.org/t/increase-legend-color-dash-thickness/49179 "2020-10-28T14:43:44Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ahmed\_Salih](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ahmed_salih/32/206579_2.png) [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Post date:** [October 28, 2020, 2:43pm UTC](https://discourse.julialang.org/t/increase-legend-color-dash-thickness/49179/1 "2020-10-28T14:43:44Z")

</div>

Hello!

How would I go about changing the size of this element marked in yellow:

![image](https://global.discourse-cdn.com/julialang/original/3X/e/6/e62ba4ef97e103ae1c88a20232c33b1bfef409ec.png)

While keeping the same line width as in my plot?

Kind regards

---

<div class="post-metadata">

**Author:** ![Ahmed\_Salih](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ahmed_salih/32/206579_2.png) [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Post date:** [October 30, 2020, 7:37am UTC](https://discourse.julialang.org/t/increase-legend-color-dash-thickness/49179/2 "2020-10-30T07:37:43Z")

</div>

Does no-one know how to do this?

Where should I post a feature request for this - perhaps it is only me who would find it nice? 🙂

Kind regards

---

<div class="post-metadata">

**Author:** ![kdyrhage](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kdyrhage/32/2326_2.png) [@kdyrhage](https://discourse.julialang.org/u/kdyrhage)\
**Post date:** [October 30, 2020, 10:14am UTC](https://discourse.julialang.org/t/increase-legend-color-dash-thickness/49179/3 "2020-10-30T10:14:32Z")

</div>

If you only want to change the width in the legend you can do something along these lines:

```julia
using Plots
n = 3
plot(rand(10, n), label = "")
plot!(rand(0, n), color_palette = palette(:default)[1:n], linewidth = [3 1 1], label = ["asd" "jkl" "qwe"])

```

---

<div class="post-metadata">

**Author:** ![Ahmed\_Salih](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ahmed_salih/32/206579_2.png) [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Post date:** [October 30, 2020, 11:40am UTC](https://discourse.julialang.org/t/increase-legend-color-dash-thickness/49179/4 "2020-10-30T11:40:34Z")

</div>

Sorry, but for me it seems to do nothing:

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

I used the commands exactly as you posted them.

Kind regards

---

<div class="post-metadata">

**Author:** ![kdyrhage](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kdyrhage/32/2326_2.png) [@kdyrhage](https://discourse.julialang.org/u/kdyrhage)\
**Post date:** [October 30, 2020, 11:44am UTC](https://discourse.julialang.org/t/increase-legend-color-dash-thickness/49179/5 "2020-10-30T11:44:13Z")

</div>

Odd, I get this:

 ![thickness](https://global.discourse-cdn.com/julialang/original/3X/4/d/4da70ea71456160caf7c718e286ec127009402a4.png)

---

<div class="post-metadata">

**Author:** ![Ahmed\_Salih](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ahmed_salih/32/206579_2.png) [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Post date:** [October 30, 2020, 11:53am UTC](https://discourse.julialang.org/t/increase-legend-color-dash-thickness/49179/6 "2020-10-30T11:53:05Z")

</div>

I am using Julia 1.5.0 what about you?

Kind regards

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [October 30, 2020, 11:56am UTC](https://discourse.julialang.org/t/increase-legend-color-dash-thickness/49179/7 "2020-10-30T11:56:35Z")

</div>

Doesn’t work for me either (Plots 1.7.3, GR 0.52 on Julia 1.5.2, Manjaro Linux)

---

<div class="post-metadata">

**Author:** ![kdyrhage](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kdyrhage/32/2326_2.png) [@kdyrhage](https://discourse.julialang.org/u/kdyrhage)\
**Post date:** [October 30, 2020, 12:09pm UTC](https://discourse.julialang.org/t/increase-legend-color-dash-thickness/49179/8 "2020-10-30T12:09:03Z")

</div>

1.5.2, but Plots and GR are apparently held back at v1.0.14 and v0.48.0 so I guess it doesn’t work in newer versions.

---

<div class="post-metadata">

**Author:** ![Ahmed\_Salih](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ahmed_salih/32/206579_2.png) [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Post date:** [October 30, 2020, 12:42pm UTC](https://discourse.julialang.org/t/increase-legend-color-dash-thickness/49179/9 "2020-10-30T12:42:32Z")

</div>

I have double checked it is an issue with GR. Using pgfplotsx() I see:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/4/2/422806684f7e76c1d64e3d0a99bbf8d4e7b8068e.png)

@jheinen sorry if it is not okay to tag you in these cases, but perhaps this would be of interest to you. It seems like newest version of Gr does not allow for changing line width in legend properly.

Kind regards

---

<div class="post-metadata">

**Author:** ![Ahmed\_Salih](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ahmed_salih/32/206579_2.png) [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Post date:** [November 12, 2020, 3:09pm UTC](https://discourse.julialang.org/t/increase-legend-color-dash-thickness/49179/10 "2020-11-12T15:09:54Z")

</div>

> [@kdyrhage](#):
>
> ```julia
> n = 3
> plot(rand(10, n), label = "")
> plot!(rand(0, n), color_palette = palette(:default)[1:n], linewidth = [3 1 1], label = ["asd" "jkl" "qwe"])
> 
> ```

Edit: For anyone wondering for some reason this is not working anymore and creating empty plots to make labels will not work properly

---

<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:** [November 13, 2020, 12:36pm UTC](https://discourse.julialang.org/t/increase-legend-color-dash-thickness/49179/11 "2020-11-13T12:36:40Z")

</div>

That was a intentional change discussed e.g. in [https://github.com/JuliaPlots/Plots.jl/issues/2655](https://github.com/JuliaPlots/Plots.jl/issues/2655) and references therein.

---

<div class="post-metadata">

**Author:** ![Ahmed\_Salih](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ahmed_salih/32/206579_2.png) [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Post date:** [November 13, 2020, 1:16pm UTC](https://discourse.julialang.org/t/increase-legend-color-dash-thickness/49179/12 "2020-11-13T13:16:49Z")

</div>

Then how would I go about making labels, but not adding any plot?

It might seem counterintuitive, but I have such a large amount of cases, where this makes sense for me. For example how would I change line width in the legend box only? I could before but not now.

I hope the new keywords mentioned in the link, `legendlinewidth` etc. get implemented, else I have to use an older version / do some kind of hack.

Kind regards
