Matplotlib 1.0.1至1.4.2

时间:2014-12-04 19:03:07

标签: python python-2.7 matplotlib

我对Python很新,我正在尝试调试同时使用TKinter和MatPlotLib的代码。最初,我使用Python 2.6.2和MatPlotLib 1.0.1。我最近使用MatPlotLib 1.4.2更新到Python 2.7 ...非常跳跃,一个颠簸的。

这是我的代码,它是图形界面的一部分,其中显示了一个基于用户给出的参数更新的图形:

## -- Algorithm is over, graph the results:
self.graph = Figure()
self.curve = self.graph.add_subplot(111, animated = TRUE, aspect = self.aspectRatio)
self.curve.set_title(translate['my figure'])
self.curve.set_xlabel(translate['xlabel'])
self.curve.set_ylabel(translate['ylabel'])
self.canvas = FigureCanvasTkAgg(self.graph, master = self.leftFrame)
self.canvas.show()
self.canvas.get_tk_widget().pack(pady=15)
self.toolbar = NavigationToolbar2TkAgg(self.canvas, self.leftFrame )    
self.toolbar.update()                                   
self.canvas._tkcanvas.pack()
self.inputBox[1][1].focus_set()

更新到Python 2.7后,基本上在图形界面中看不到任何内容,没有绘制图表。令我惊讶的是,绝对没有错误信息。

因此,我认为实际绘制或显示MatPlotLib 1.0.1到1.4.2的图形的方式可能有一些修改。我有什么明显的遗失吗?任何人都可以知道MatPlotLib中可能会发生什么变化可能会产生这个问题吗?

我希望我可以更具体,但没有错误消息会让调试变得非常困难......


我一直在研究这个问题,发现问题似乎从 MatPlotLib 1.0.1 转到 MatPlotLib 1.1.1 ,这缩小了我对发行说明的扫描范围( MatPlotLib, what is new in 1.1)以了解正在发生的事情。

1 个答案:

答案 0 :(得分:1)

问题是你有动画"设置为true,你实际上并没有做动画(至少不是你所展示的动画)。变化

self.curve = self.graph.add_subplot(111, animated = TRUE, aspect = self.aspectRatio)

self.curve = self.graph.add_subplot(111, aspect = self.aspectRatio)

如果你想做动画here就是一个例子。