我有一个应用程序,有3个数字,并动态改变他们。目前,通过在图中使用add_subplot()
可以很好地工作。但是现在我必须使我的图更复杂,并且需要使用subplot2grid()
self.figure1 = plt.figure()
self.canvas1 = FigureCanvas(self.figure1)
self.graphtoolbar1 = NavigationToolbar(self.canvas1, frameGraph1)
self.figure3 = plt.figure()
self.canvas3 = FigureCanvas(self.figure3)
self.graphtoolbar3 = NavigationToolbar(self.canvas3, frameGraph3)
self.figure4 = plt.figure()
self.canvas4 = FigureCanvas(self.figure4)
self.graphtoolbar4 = NavigationToolbar(self.canvas4, frameGraph4)
下面是添加它的代码,以及到目前为止我所得到的。在
^{pr2}$上图将其添加到图4中。可能是因为这是plt最新的实例。但是,我希望上面的代码在self.figure1
中添加一个子blot2grid,同时仍像以前一样具有动态功能。在
查看
matplotlib
的源代码,subplot2grid
-函数定义如下:正如您从代码片段中的注释“HERE”中看到的,它只使用活动图形,即
fig = gcf()
(gcf是“getcurrent figure”的缩写)。在通过稍微修改函数并将其放入脚本中,应该很容易实现目标。在
^{pr2}$现在应该可以做你的事情了,修改你的函数调用
希望有帮助!在
相关问题 更多 >
编程相关推荐