Disable log scale when value is within 0.1 of zero for Histograms#13496
Open
eilskra wants to merge 1 commit intoequinor:mainfrom
Open
Disable log scale when value is within 0.1 of zero for Histograms#13496eilskra wants to merge 1 commit intoequinor:mainfrom
eilskra wants to merge 1 commit intoequinor:mainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #13496 +/- ##
==========================================
- Coverage 90.00% 85.35% -4.65%
==========================================
Files 460 460
Lines 32332 32329 -3
==========================================
- Hits 29101 27595 -1506
- Misses 3231 4734 +1503
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Contributor
|
Needs a backport to |
eqbech
reviewed
May 7, 2026
Comment on lines
+422
to
+425
| # Use 0.11 instead of 0 because the histogram | ||
| # expands the range by ±0.1 when min == max, | ||
| # which would make a value of 0.1 become a negative bin edge. | ||
| if not numeric.empty and numeric.le(0.11).any().any(): |
Contributor
There was a problem hiding this comment.
Is it possible to make this magic number a const and encapsulate some of the information in the comments in its name, if not you can also add a comment over/under the const for further explanation maybe?
The histogram expands the range by ±0.1 when min equals max. If the original minimum is a small positive value (e.g. 0.07), this adjustment produces a negative lower bin edge, which breaks the log-scale. The `negative_values_in_data` guard now uses `≤ 0.11` instead of `≤ 0` so that any value close enough to zero to become non-positive or 0 after the ±0.1 expansion also disable the log-scale button.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue
Resolves #12527
Approach
The histogram expands the range by ±0.1 when min equals max. If the original minimum is a small positive value (e.g. 0.07), this adjustment produces a negative lower bin edge, which breaks the log-scale.
The
negative_values_in_dataguard now uses< 0.11instead of≤ 0so that any value close enough to zero to become non-positive or 0 after the ±0.1 expansion also disable the log-scale button.Removed +- 0.5 as this is condition won't be met since if min == max, then +- 0.1 prior to
_histogramLogBinsgit rebase -i main --exec 'just rapid-tests')When applicable