使用Matplotlib进行多图排列
我们能控制一下 Matplotlib 在屏幕上放置图形的位置吗?
我想生成四个图形(在四个不同的窗口里),而且它们不能重叠。
2 个回答
3
你也可以使用IPython界面配合Qt后端来实现类似的效果:
import matplotlib
import pylab as pl
f1 = pl.figure()
f_manager = pl.get_current_fig_manager()
f_manager.window.move(600, 600)
pl.show()
通过f_manager,你基本上有一个PyQt4对象,这个对象让你可以随意修改窗口的属性。
8
在 IPython 中,你可以这样做:
figure()
get_current_fig_manager().window.wm_geometry("400x600+20+40")
或者在一个 Python 脚本中也可以这样写:
import pylab as pl
pl.figure()
pl.get_current_fig_manager().window.wm_geometry("400x600+20+40")
pl.show()
请注意,这里假设你使用的是 TkAgg 这个后端。