Plots.jl: Erroneous legend line-properties with pgfplotsx()

Created on 4 Mar 2020  路  9Comments  路  Source: JuliaPlots/Plots.jl

With the pgfplotsx backend, the legend gets messed up when one includes a non-labeled series.

julia> plot(rand(10,3), label=["1" "" "3"], color=["blue" "red" "green"])

Here, the third line, "3", is green, but the legend uses the line properties of the second line and thus calls it red.

The pgfplotsx backend still has a bunch of bugs, but I do like it and think it will be great when those are ironed out. Thanks and keep up the good work!

PGFPlotsX bug

Most helpful comment

Thanks for reporting. And don't hesitate to tell me other bugs, when you find them.

All 9 comments

Thanks for reporting. And don't hesitate to tell me other bugs, when you find them.

Thanks! :slightly_smiling_face:

Thanks for responding so quickly but the fix did not work for everything.

plot(rand(4,4), label=["a" "" "" "c"]);
vline!([1,1]);
plot!(rand(4,1), label="red?", color=:red)

The first plot command is now fine, but the last one yields a red line with a non-red legend entry.

Since I can't re-open the issue I'll take the liberty of pinging @BeastyBlacksmith

Note that reordering of the commands produces the correct result, so probably a bug in vline

plot(rand(4,4), label=["a" "" "" "c"]);
plot!(rand(4,1), label="red?", color=:red);
vline!([1,1])

I'm not sure where the bug is, but also note:

plot(rand(4,4), label=["a" "" "" "c"]);
vline!([1,1,1]);
plot!(rand(4,4), label="red?", color=:red)

here, the two last red lines are correct but the first two are not.

vline!([1,1,1]) produces three lines but only one legend entry. The indexing following this command might be a little off.

actually vline shouldn't create any legend entries

and yet it does. Also, I don't have an opinion about what the default should be, but it would be good if there was an option for creating a legend entry for a vline.

Would be nice, if you could try the branch of https://github.com/JuliaPlots/Plots.jl/pull/2449 and report, if it fixes your cases as well.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

apalugniok picture apalugniok  路  3Comments

jebej picture jebej  路  4Comments

dancsi picture dancsi  路  4Comments

lstagner picture lstagner  路  5Comments

ereday picture ereday  路  3Comments