-
-
Notifications
You must be signed in to change notification settings - Fork 358
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
Warn on invalid value for log scale based series #3601
Conversation
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.
This is awesome -- thanks for looking into this! I think it's a great UX improvement.
However, I don't think that we should sanitize the data: it is the responsibility of the user not to feed invalid data (since again this is undefined behavior, and fixing undef is arbitrary and thus subject to debate).
The GR warning still showing up would be my only minor complaint, but I do see your point. And since are printing the bigger warning anyway, I think it's fine.
My only concern would be that passing broken data on to the backend may break it. I do manage to break GR on a regular basis (as in, independent follow-up plots in the same session fail to work render, and I have to either change backend or restart Julia).
On another note, for some reason, for the original MWE it does print the new warning three times:
julia> plot(
1:5, [1,2,0,4,5],
m = [:utriangle, :dtriangle, :utriangle, :dtriangle, :dtriangle],
yaxis = :log10, ylims = (1e-1, 1e1),
)
┌ Warning: Invalid negative or zero value 0.0 found at serie index 3 for log10 based yscale
└ @ Plots ~/.julia/packages/Plots/7T4MM/src/utils.jl:92
GKS: Number of points is invalid in routine POLYLINE
┌ Warning: Invalid negative or zero value 0.0 found at serie index 3 for log10 based yscale
└ @ Plots ~/.julia/packages/Plots/7T4MM/src/utils.jl:92
┌ Warning: Invalid negative or zero value 0.0 found at serie index 3 for log10 based yscale
└ @ Plots ~/.julia/packages/Plots/7T4MM/src/utils.jl:92
It's in the REPL.. so perhaps it is because when it opens the GKS QtTerm window, it renders it multiple times or something along those lines?
Thanks for the feedback !
Dully noted.
In the end the plots appears or is saved to file, so this doesn't "break" GR in the running julia session, does it ?
Yes, I've seen that. By inspecting the new debug traces, I found why it happened and pushed a fix. Can you try with the latest commit ? On my machine I now get: $ julia bug.jl
┌ Warning: Invalid negative or zero value 0.0 found at series index 3 for log10 based yscale
└ @ Plots [...]/Plots/Bfn5f/src/utils.jl:92
GKS: Number of points is invalid in routine POLYLINE |
Fixed. |
Codecov Report
@@ Coverage Diff @@
## master #3601 +/- ##
=======================================
Coverage 65.09% 65.09%
=======================================
Files 27 27
Lines 6660 6672 +12
=======================================
+ Hits 4335 4343 +8
- Misses 2325 2329 +4
Continue to review full report at Codecov.
|
Yup, can confirm that it's now down to just one warning!
Ah, I did not mean that this particular case breaks GR. Even if GR emits the However, in the past I have managed to break GR to the point where even follow-up plots fail to render properly by (accidentally) passing bad data to |
With this PR, the example in #3594 now shows a warning or a full stacktrace controlled via the
JULIA_DEBUG
environment variable.@mortenpi, is this what you expect ?
If someone has a tip for logging the messages only once, I'm all ears ...==> now warning only once
Not sure about the potential performance penalty traversing series though.==> now traversing only once
Fix #3594.