-
-
Notifications
You must be signed in to change notification settings - Fork 348
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
Fix for "segmented" attributes with NaNs #3320
Conversation
…egments-nan-attr [AUTO] Update precompiles
In general, I'd also find this more consistent. However, I'm not sure if this "just" is a bugfix or breaking. x = [1, 3, 2, NaN, 4, 6, 5, NaN, 0, 1, 1, 0]
y = [2, 2, 3, NaN, 0, 1, 0, NaN, 0, 0, 1, 1]
plot(x, y, st=:shape, fillcolor=[:red, :blue, :green])
plot(x, y, st=:shape, fill_z=1:3) same results for xs = [[1, 3, 2], [4, 6, 5], [0, 1, 1, 0]]
ys = [[2, 2, 3], [0, 1, 0], [0, 0, 1, 1]]
shapes = Shape.(xs, ys)
plot(shapes, fillcolor=[:red, :blue, :green])
plot(shapes, fill_z=1:3) I wonder if we can keep the old behavior somehow with the changes in this PR (and still be consistent). I can be quite handy. I used it sometimes for plotting shapefile maps and coloring countries according to some values. |
I agree @daschw , this is a (not necessarily desirable) behaviour change rather than a fix. |
@daschw, I would say that the "before" plots in your first example are definitely a bug. I think that it's extremely surprising that the way indexes in attributes correspond to indexes in data depends in any way on the contents rather than types and shapes. Real data is eventually going to contain The second example is more compelling, and not something I've tested. It's not consistent with the behavior of a plain To deal with the breakage, perhaps we can add a "soft deprecation", i.e. a warning when sizes of "segmenting" attributes don't match, and an extra warning when |
I fixed the
gives
An alternative would be to merge these message and show them only when the data has |
…egments-nan-attr [AUTO] Update precompiles
Hmm, I'm being swayed by the good arguments here, sorry for making noise. |
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.
Codecov Report
@@ Coverage Diff @@
## master #3320 +/- ##
==========================================
- Coverage 65.17% 63.00% -2.18%
==========================================
Files 25 25
Lines 6456 6098 -358
==========================================
- Hits 4208 3842 -366
- Misses 2248 2256 +8
Continue to review full report at Codecov.
|
The behavior of NaN separated segments was changed in JuliaPlots/Plots.jl#3320
Fixes indexing into attributes that vary by series or data point, so that it is not affected by
NaN
values.Some examples that previously produced either a
BoundsError
or silently wrong output:Fixes #3258 (maybe also #2959?).
Breaks the current reference image 48, but I don't think the current behavior is documented other than in this reference image. As I mentioned in #3258 (comment), I think this fix is important enough to break it.