Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Erroneous legend line-properties with pgfplotsx() #2432

Closed
korsbo opened this issue Mar 4, 2020 · 9 comments · Fixed by #2435 or #2449
Closed

Erroneous legend line-properties with pgfplotsx() #2432

korsbo opened this issue Mar 4, 2020 · 9 comments · Fixed by #2435 or #2449

Comments

@korsbo
Copy link
Contributor

korsbo commented Mar 4, 2020

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!

@BeastyBlacksmith
Copy link
Member

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

@korsbo
Copy link
Contributor Author

korsbo commented Mar 4, 2020

Thanks! 🙂

@korsbo
Copy link
Contributor Author

korsbo commented Mar 10, 2020

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

@BeastyBlacksmith
Copy link
Member

BeastyBlacksmith commented Mar 10, 2020

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

@korsbo
Copy link
Contributor Author

korsbo commented Mar 10, 2020

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.

@korsbo
Copy link
Contributor Author

korsbo commented Mar 10, 2020

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

@BeastyBlacksmith
Copy link
Member

actually vline shouldn't create any legend entries

@korsbo
Copy link
Contributor Author

korsbo commented Mar 10, 2020

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.

@BeastyBlacksmith
Copy link
Member

Would be nice, if you could try the branch of #2449 and report, if it fixes your cases as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants