所有Pyplot图表的默认尺寸

发布于 2025-01-31 11:32:27 字数 293 浏览 3 评论 0原文

我有一个笔记本,上面有几个地块,从一开始就可以使用以下代码:

plt.rcParams['figure.figsize'] = [16, 9]
plt.rcParams['figure.dpi'] = 100

因此,笔记本中生成的所有图表都有此大小。这只是停止工作(我想在上一个PIP更新后),现在所有图表都具有不同的默认大小(小得多)。

现在,如何为所有Pyplot图表设置默认大小?

I have a notebook with several plots where I have at the very beginning the following code:

plt.rcParams['figure.figsize'] = [16, 9]
plt.rcParams['figure.dpi'] = 100

So that all the charts generated in the notebook have this size. This just stopped working (I suppose after the last pip update) and now all the charts have a different default size (much smaller).

How can I set now the default size for all my pyplot charts?

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

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

发布评论

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

评论(1

烧了回忆取暖 2025-02-07 11:32:27

罗里,你是对的。

不知何故,我错过了%matplotlib inline魔术函数,然后才能设置绘图的属性。这就是现在对我有用的东西:

%matplotlib inline
plt.rcParams['figure.figsize'] = [16, 9]
plt.rcParams['figure.dpi'] = 100

谢谢!

Rory, you are right.

Somehow I missed the %matplotlib inline magic function before settings the properties of the plot. So this is what is working for me now:

%matplotlib inline
plt.rcParams['figure.figsize'] = [16, 9]
plt.rcParams['figure.dpi'] = 100

Thanks!

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