Skip to content

make PlotItem's average pen and shadow pen accessible#2052

Merged
j9ac9k merged 2 commits intopyqtgraph:masterfrom
NilsNemitz:avgPen
Nov 6, 2021
Merged

make PlotItem's average pen and shadow pen accessible#2052
j9ac9k merged 2 commits intopyqtgraph:masterfrom
NilsNemitz:avgPen

Conversation

@NilsNemitz
Copy link
Copy Markdown
Contributor

#2040 points out that the average curve that can be activated from the context menu of PlotItem includes 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.avgPen and PlotItem.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.

crosshair

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.

@j9ac9k
Copy link
Copy Markdown
Member

j9ac9k commented Nov 6, 2021

Thanks for the PR @NilsNemitz guess this one was easy to overlook as we had written off thick-lines.

@j9ac9k j9ac9k merged commit e971cc6 into pyqtgraph:master Nov 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Plot Options -> Average invokes thick pen plotting slow path

2 participants