-
Notifications
You must be signed in to change notification settings - Fork 153
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
Redraw empty histogram layer #2300
Conversation
Codecov Report
@@ Coverage Diff @@
## main #2300 +/- ##
==========================================
- Coverage 88.14% 88.11% -0.04%
==========================================
Files 247 247
Lines 23365 23369 +4
==========================================
- Hits 20596 20591 -5
- Misses 2769 2778 +9
Continue to review full report at Codecov.
|
@Carifio24 - this looks good! Could you add a test and changelog entry? |
@astrofrog I've added a changelog entry and a test ( |
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.
Looks good, thanks!
This PR addresses an issue that was discussed at a glue meeting a little while ago (don't remember the exact date). The issue is that if a subset group is modified to make it empty, the corresponding histogram layer artist is not redrawn. See the video below.
histogram-bug.mp4
The issue seems to be here, where
_update_artists
return if the sum of the histogram is empty (that is, the layer has no content). To fix this, I've removed thempl_hist.sum() == 0
check. Allowing the possibility for empty layer opens the door for thelargest_y_max
andsmallest_y_min
values computed later in the method to be NaN or infinite (in particular, if all of the layers are empty). I couldn't think of a better default behavior than just punting on updating the bounds in this case, so I've addednumpy.isfinite
checks around both assignments to the relevant viewer state properties.