如何在 python 中自动最大化 pylab 绘图窗口?

发布于 2024-12-12 17:23:38 字数 465 浏览 6 评论 0原文

在 python 中(在 Ubuntu Linux 下),我使用 pylab 来绘图。

当我调用时:

pylab.savefig(filename)

它以当前屏幕分辨率保存图形。如果我有很多子图,看起来会很糟糕,所以我通常必须在调用“savefig”之前手动最大化窗口。

示例:

-- 不最大化窗口

-- 窗口最大化

有没有办法自动最大化 pylab 窗口?

(我看到有人发布了使用 win32gui 的 Windows 解决方案,但我使用的是 Linux)

谢谢!

In python (under Ubuntu Linux), I'm using pylab to make plots.

When I call:

pylab.savefig(filename)

It saves the figure at the current screen resolution. The looks terrible if I have lots of subplots, so I usually have to manually maximize the window before I call 'savefig'.

Examples:

-- Without maximizing the window

-- With window maximized

Is there some way to automatically maximize a pylab window?

(I saw someone had posted a solution for Windows using win32gui, but I'm in Linux)

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

遗忘曾经 2024-12-19 17:23:39

您可以通过以下方式更改分辨率:

pylab.savefig('new.png', dpi = 500)

You can change resolution this way:

pylab.savefig('new.png', dpi = 500)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文