Increase legend color dash thickness?


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


While keeping the same line width as in my plot?

Kind regards

1 Like

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? :slight_smile:

Kind regards

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

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"])

Sorry, but for me it seems to do nothing:

I used the commands exactly as you posted them.

Kind regards

Odd, I get this:

I am using Julia 1.5.0 what about you?

Kind regards

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

1 Like

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.

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

@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

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

That was a intentional change discussed e.g. in and references therein.

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