【问题标题】:How to use multiple axes with finplot as a widget in layout如何在 finplot 中使用多个轴作为布局中的小部件
【发布时间】:2022-01-10 12:40:10
【问题描述】:
我用过finplot as a widget in layout - 效果很好:
self.tab1.fplt_widget = pg.PlotWidget(
plotItem=fplt.create_plot_widget(self.window())
)
我想做的是使用上面的小部件,但也有多个轴,即:
ax, ax1 = fplt.create_plot_widget(self.window())
这将如何工作?
【问题讨论】:
标签:
python
python-3.x
pyqt5
pyqtgraph
【解决方案1】:
最后我只是使用了pg.GraphicsLayoutWidget的包装器:
class ChartGraphWidget(pg.GraphicsLayoutWidget):
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.centralWidget.installEventFilter(self)
self.ci.setContentsMargins(0, 0, 0, 0)
self.ci.setSpacing(-1)
self.show_maximized = True # maximize
sx0 = axs = fplt.create_plot_widget(
master=self, rows=4, init_zoom_periods=50)
...
我还发现单个pg.GraphicsLayoutWidget 具有多个轴比每个pyqtgraph.dockarea 的轴快得多。