make PlotItem's average pen and shadow pen accessible#2052
Merged
j9ac9k merged 2 commits intopyqtgraph:masterfrom Nov 6, 2021
Merged
make PlotItem's average pen and shadow pen accessible#2052j9ac9k merged 2 commits intopyqtgraph:masterfrom
j9ac9k merged 2 commits intopyqtgraph:masterfrom
Conversation
Member
|
Thanks for the PR @NilsNemitz guess this one was easy to overlook as we had written off thick-lines. |
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.
#2040 points out that the average curve that can be activated from the context menu of
PlotItemincludes a wide shadowPen . This is by default set to be partially opaque, which prevents fast drawing as individual line segments.This PR implements a minimalistic fix to this problem by redefining the shadow pen to be a solid black. This should still ensure the visibility of the average line over any kind of background.
To allow somewhat improved access to the colors of the average line, it defines these as
Plotitem.avgPenandPlotItem.avgShadowPen, which can be replaced by user code (as long as this is done before the averaging mode is activated).Finally, it applies this restyling to the crosshair.py example to improve the chance to find this option if needed.
A follow-up step would be to create a proper API, but this would probably need to include code to handle redrawing the line when restyled, and would thus be more complex than this quick fix :)
This closes #2040: With the solid black shadow pen that is now the default, the example plot pans smoothly even with the average enabled.