Fix ViewBox.autoRange() for case of data with constant y-value#2489
Merged
j9ac9k merged 1 commit intopyqtgraph:masterfrom Oct 29, 2022
Merged
Fix ViewBox.autoRange() for case of data with constant y-value#2489j9ac9k merged 1 commit intopyqtgraph:masterfrom
ViewBox.autoRange() for case of data with constant y-value#2489j9ac9k merged 1 commit intopyqtgraph:masterfrom
Conversation
Member
Contributor
Author
Member
|
Thanks for the PR @bbc131 this LGTM, merging! |
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.
Calling
ViewBox.autoRange()multiple times lead to different results if the plotted data points have all identical y-values. For example, when you plot an array like [1.0, 1.0, ... 1.0], as I do in the mwe below.The reason for that can be found in
ViewBox.setRange(rect, padding, ...), where for this special case of 0 extent of the vertical axis, the current visible range shall be preserved, see also comment "If we requested 0 range, try to preserve previous scale." in line 594.But with
paddingbeing not equal to 0.0, the current visible range is not preserved, but rather enlarged by the padding.The only way I see to circumvent this is to add some other special handling here.
Here a mwe which simply plots some data as described above und further calls
ViewBox.autoRange()when you click into the widget.