Skip to content

Curve fillLevel behaviour with enableExperimental #2878

@dmax366

Description

@dmax366

Short description

Are fill levels for PlotDataItems supposed to be supported while useOpenGL and enableExperimental are True?
A comment in another issue (#2257) mentions that fill levels are not supported while enableExperimental is False, but I observe the opposite.
Also, why does fill level support depend on enableExperimental, but FillBetweenItem objects are able to display whether enableExperimental is true or false?

Code to reproduce

The code below generates one curve with the fillLevel set and a FillBetweenItem using a different curve, so the two behaviours can be compared.
There is a button to toggle enableExperimental.

import pyqtgraph as pg
from pyqtgraph.Qt import QtWidgets

import numpy as np

pg.setConfigOptions(useOpenGL = True, enableExperimental = False)

app = pg.mkQApp('OpenGL / Experimental Test')
win = pg.GraphicsLayoutWidget(show = True, title = 'OpenGL / Experimental Test')

plot = win.addPlot(title = 'Sinusoidal')
x_data = np.linspace(-10, 10, 1000)
curve = plot.plot(x_data, np.sin(x_data), pen = 'green', fillLevel = 0, fillBrush = pg.mkBrush((150, 0, 200, 100)), name = 'Sinusoidal')
y_data = np.sin(x_data*2.0)
curve2 = plot.plot(x_data, y_data, pen = 'red', name = 'Sinusoidal 2')

filler = pg.FillBetweenItem(curve, curve2, brush = pg.mkBrush((200, 200, 0, 100)), pen = 'pink')
plot.addItem(filler)

button = QtWidgets.QPushButton('enableExperimental = False')
en_exp = False
def toggle_experimental():
    global en_exp, button
    en_exp = not en_exp
    pg.setConfigOptions(enableExperimental = en_exp)
    button.setText(f'enableExperimental = {en_exp}')

button.clicked.connect(toggle_experimental)
proxy = QtWidgets.QGraphicsProxyWidget()
proxy.setWidget(button)

win.addItem(plot, 0, 0)
win.addItem(proxy, 1, 0)

win.show()
pg.exec()

Expected behavior

The curve with fillLevel set should be filled while enableExperimental = True.

Real behavior

The curve with fillLevel set is not filled while enableExperimental = True. Instead, it is filled while enableExperimental = False.

Tested environment(s)

  • PyQtGraph version: 0.13.3
  • Qt Python binding: PyQt6 6.5.3 Qt 6.5.3
  • Python version: 3.11.1
  • NumPy version: 1.24.3
  • Operating system: Windows 10
  • Installation method: pip

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions