Skip to content

Fix filled log plot auto-connect - #3523

Open
cookesan wants to merge 1 commit into
pyqtgraph:masterfrom
cookesan:filllevel-connect-all
Open

Fix filled log plot auto-connect#3523
cookesan wants to merge 1 commit into
pyqtgraph:masterfrom
cookesan:filllevel-connect-all

Conversation

@cookesan

Copy link
Copy Markdown
Contributor

Summary

  • keep filled PlotDataItem curves continuous when connect="auto" and log mode creates non-finite points
  • add a seeded histogram regression for filled center-step plots in log Y mode

Fixes #2312.

Tests

  • QT_QPA_PLATFORM=minimal .venv/bin/pytest tests/graphicsItems/test_PlotDataItem.py::test_filled_log_plot_auto_connects_across_nonfinite_values -q
  • QT_QPA_PLATFORM=minimal .venv/bin/pytest tests/graphicsItems/test_PlotDataItem.py -q
  • QT_QPA_PLATFORM=minimal .venv/bin/pytest tests/graphicsItems/test_PlotCurveItem.py -q
  • QT_QPA_PLATFORM=minimal .venv/bin/pytest tests/graphicsItems -q
  • .venv/bin/python -m compileall pyqtgraph/graphicsItems/PlotDataItem.py tests/graphicsItems/test_PlotDataItem.py
  • git diff --check

@pijyoi

pijyoi commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

#3071 implements filling under the curve when connect="finite". You can see how it works in the MouseSelection example.

It seems to me that in this PR, this drawing mode would be bypassed for all plots, Log mode or not?

@pijyoi

pijyoi commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Disregard the above comment. The logic in this PR only applies if connect="auto"

So the below snippet will work properly. i.e. break the curve into continuous segments and fill them.

import numpy as np

import pyqtgraph as pg

pg.mkQApp()
plt = pg.PlotWidget()

x = np.arange(0, 1000, dtype=float)
x[(250, 500, 750),] = np.nan
y=np.sin(np.linspace(1, 21, 1000))
plt.plot(x=x, y=y, pen='g', connect="finite", fillLevel=0, brush=(50,50,200,100))

plt.show()
pg.exec()

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.

artifacts in fill under curve for histograms in log mode

2 participants