matplotlib 窗口布局问题 [英] matplotlib window layout questions

查看:41
本文介绍了matplotlib 窗口布局问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个关于 mpl 窗口定位的问题(使用 WXAgg 后端)

I have two questions regarding to the positioning of a mpl window (using WXAgg backend)

1-)如何创建最大化的窗口,而不是每次都单击窗口以最大化它?

1-) How to create a maximized window, instead of me clicking on window to maximize it each time?

2-) 我有两个屏幕.有趣的是,我的mpl窗口倾向于在小屏幕上打开.如何强制mpl/ipython/WX/X-windows在第二台或更大的显示器上打开mpl窗口?

2-) I have two screens. Interestingly, my mpl windows tend to open on my small screen. How can I force mpl/ipython/WX/X-windows to open mpl windows on my 2nd and bigger monitor?

谢谢.

推荐答案

相对于第一个问题,您可以在图形管理器上使用 Maximize (因为图形管理器是 FigureManagerWx 实例)或其他后端的等效方法:

Relative to your first question, you can use Maximize on your figure manager (as your figure manager is a FigureManagerWx instance) or equivalent methods in case of other backends:

>>> from matplotlib import pyplot as plt
>>> plt.plot([1,2,6,4])
[<matplotlib.lines.Line2D object at 0x0000000008E5D2E8>]
>>> mng = plt.get_current_fig_manager()
>>> plt.show()                                    # you get normal size
>>> mng.frame.Maximize(True)                      # now mpl window maximizes

对于第二个问题,我不确定(我无法测试)但是如果可以通过在两个显示器中扩展的屏幕中设置图形的位置来解决问题,那么您可以使用 SetPosition(再次用于wxAgg 后端):

For the second question, I am not sure (i can not test it) but if the problem can be solved by setting the position of your figure in a screen extended in two monitors, then you can use SetPosition (again for a wxAgg backend):

>>> mng.frame.SetPosition(*args, **kwargs)

这篇关于matplotlib 窗口布局问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆