I place a widget in Qt Creator and promote it to a PyQtGraph PlotWidget. I'd like to use a custom AxisItem with that widget. Is there any way to replace the existing axis or do I have to subclass PlotWidget?
Asked
Active
Viewed 434 times
2 Answers
1
There is not currently a way to replace an existing axis; use a subclass as you suggested.

Luke
- 11,374
- 2
- 48
- 61
-
1How do you go about using a subclass? Can someone offer an example? – readytotaste Jun 01 '18 at 14:39
0
Still there isnt a way to replace existing axis without promoting to a PlotWidget
subclass as mentioned in the other answers. For someone looking for an example subclass for PlotWidget
that uses x axis as DateAxisItem
here it is:
from pyqtgraph import PlotWidget, DateAxisItem
class XDateTimeAxis_PlotWidget(PlotWidget):
def __init__(self, parent=None, background='default', plotItem=None, **kargs):
super(XDateTimeAxis_PlotWidget, self).__init__(parent=parent, background=background, plotItem=plotItem, axisItems = {'bottom': DateAxisItem()}, **kargs)

tonyjosi
- 717
- 1
- 9
- 17