Repository navigation
[FIX] Plot axes: No SI prefix for values below 1 with pyqtgraph 0.14 - #7337
Open
raashish1601 wants to merge 2 commits into
Open
raashish1601 wants to merge 2 commits into
raashish1601 wants to merge 2 commits into
Conversation
Codecov Report❌ Patch coverage is ❌ Your patch check has failed because the patch coverage (75.00%) is below the target coverage (95.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## master #7337 +/- ##
==========================================
- Coverage 88.98% 88.97% -0.01%
==========================================
Files 337 337
Lines 74598 74602 +4
==========================================
Hits 66378 66378
- Misses 8220 8224 +4 🚀 New features to boost your workflow:
|
Author
|
Added a test for axes with units, which covers the line codecov flagged. The "Scientific Python nightly wheels" job is unrelated: it fails with ~560 errors from the nightly pyqtgraph ( |
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
Fixes #7272
Description of changes
With pyqtgraph 0.14, plot axes without units get an SI prefix for any range below 1, so a Scatter Plot of values between 0 and 1 shows
(x0.001)and ticks scaled by 1000. pyqtgraph 0.14 addedgetSIPrefixEnableRanges, and for axes without units its default is((0, 1), (1e9, inf)). pyqtgraph 0.13 instead skipped themandkprefixes for such axes, so nothing was scaled between 1e-3 and 1e6.StyledAxisItem(the base of Orange'sAxisItem, used by Scatter Plot, Line Plot, Bar Plot, heat maps and others) now overridesgetSIPrefixEnableRangesand returns((0, 1e-3), (1e6, inf))for axes without units, which is the 0.13 behaviour. Axes with units keep pyqtgraph's default. I overrode the getter rather than callingsetSIPrefixEnableRangesonce, becausesetLabel(called on every axis update) resets the ranges. pyqtgraph 0.13 never calls this method, so nothing changes there.Tests:
TestAxisItem.test_si_prefix_without_unitschecks the scale for ranges up to 0.5, 5e5, 5e-4 and 5e6. On pyqtgraph 0.14 it fails without the change (scale 1000 for 0.5) and passes with it; on pyqtgraph 0.13.7 it passes either way.test_plotutils.py,test_owscatterplot.py,test_owlineplot.py,test_owbarplot.pyandtest_owdistributions.pypass locally (Windows, pyqtgraph 0.14.0, against the Orange 3.40 wheel with this patch applied).Includes