-
-
Notifications
You must be signed in to change notification settings - Fork 372
Fixed missing marker in legend when plotting a series whose first entry is NaN #4328
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
Conversation
…`gr_draw_markers`, since a legend entry only has one marker (if any).
|
You might want to read https://docs.juliaplots.org/stable/contributing/#Write-code,-and-format. Also, please rebase your PR against current master for CI to run without errors. |
Codecov ReportBase: 80.23% // Head: 81.05% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #4328 +/- ##
==========================================
+ Coverage 80.23% 81.05% +0.81%
==========================================
Files 29 28 -1
Lines 7009 7316 +307
==========================================
+ Hits 5624 5930 +306
- Misses 1385 1386 +1
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
|
Every check passed except "ci / Julia 1.6 - macos-latest (pull_request)". Does this mean the fix (or the changes made to the original project) is not compatible with Julia1.6 on MacOS? I use Ubuntu, so I'm not sure what I should do about this. |
|
This is just a spurious random error related to network failure : I'm re-running the failed job now, don't worry this is not blocking. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that this PR is well explained (here and on discourse), and I see no regressions in the examples on ci, so I don't see any reason why this shouldn't go in.
BeastyBlacksmith
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this fix! You might want to check out #3503.
|
You're welcome, thanks for the review! |
Adding name to contributor list after first bug fix accepted (JuliaPlots#4328 (comment)).
Adding name to contributor list after first bug fix accepted (#4328 (comment)).
Changed function
gr_add_legendto callgr_draw_markerinstead ofgr_draw_markers, since a legend entry only has one marker (if any).Fix #3996
I explained the issue and solution in greater detail in this post: https://discourse.julialang.org/t/fixing-missing-marker-in-plot-legend-when-first-value-in-series-is-nan/86658
In summary, the example
produced a graph with no marker in the legend:

This only happens when the first entry in the series is NaN. If only the second entry is NaN, we get:
Morever, this behavior does not happen for the PlotlyJS backend (I did not test backends besides GR and PlotlyJS):
he second entry is NaN, we get:
By changing the
gr_draw_markerscall to agr_draw_markercall, this behavior was fixed. Now the exampleproduces the following graph:

And it works for a single series with multiple marker shapes as well:
The only downside I can see is the following example:
The marker in the legend is a circle, although no circle appears in the series because the first entry in the series is not plotted (because it's NaN). Still, the previous behavior was to have no marker at all, which I think is worse.