更改matplotlib图,渲染回jupyter笔记本中的默认值

发布于 2025-02-11 06:49:36 字数 267 浏览 1 评论 0原文

我运行%config inlineBackend.figure_format ='entina'在jupyter笔记本中,以更改笔记本渲染matplotlib的方式。

如何在不重新启动内核的情况下扭转

我之所以问,是因为有些数字在%config InlineBackend.figure_format ='entina'中看起来更好,而在默认设置中有些看起来更好。只是好奇您如何在笔记本上的两者之间切换。

I ran %config InlineBackend.figure_format = 'retina' in a jupyter notebook to change the way the notebook renders matplotlib figures.

How do I reverse that without restarting the kernel?

I'm asking because some figures look better with %config InlineBackend.figure_format = 'retina' and some look better with the default settings. Just curious how can you switch between the two across the notebook.

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

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

发布评论

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

评论(1

皇甫轩 2025-02-18 06:49:36

这对我有用:

from matplotlib_inline.backend_inline import set_matplotlib_formats
set_matplotlib_formats('svg')

我发现您可以将格式设置为:

  • 'png'
  • 'entina'
  • 'jpeg'jpeg'
  • 'svg'
  • 'pdf

每个都有一些优点和缺点。

This worked for me:

from matplotlib_inline.backend_inline import set_matplotlib_formats
set_matplotlib_formats('svg')

I found you can set the format to:

  • 'png'
  • 'retina'
  • 'jpeg'
  • 'svg'
  • 'pdf

Where each has some pros and cons.

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