python - 将 python 图扩展到全屏

标签 python matplotlib mpld3

我想将我使用 mpld3 绘制的 python 图扩展到全屏。由于以下原因,我希望使用 mpld3

  • 我希望有大约 4 个地 block ,每个地 block 都有缩放选项。
  • 所有绘图必须显示在同一窗口中。

在这里,我尝试使用 tight_layout 选项来扩展绘图以占据全屏,但它不起作用,如最后的链接所示。我猜 tight_layout 不适用于 mpld3。有没有其他方法让它拉伸(stretch)到全屏?

此外,如何将文本添加到正在绘图的屏幕上?比如4个图从上到下占据了90%的屏幕,文字占据了底部剩下的10%?

import matplotlib.pyplot as plt
import mpld3


x = [1,2,3]
y = [1,4,9]

fig = plt.figure()
ax = fig.add_subplot(411)
ax.plot(x,y)
ax = fig.add_subplot(412)
ax.plot(x,y)
ax = fig.add_subplot(413)
ax.plot(x,y)
ax = fig.add_subplot(414)
ax.plot(x,y)
fig.tight_layout()
mpld3.show()

最佳答案

我认为大小是由 matplotlib 定义的,这意味着调整它会导致全屏绘图。

来自本主题:How to maximize a plt.show() window using Python

mng = plt.get_current_fig_manager()
mng.frame.Maximize(True)

这样的事情可能会奏效。

关于python - 将 python 图扩展到全屏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28187202/

相关文章:

python - 导入错误: No module named simplify

python - 如何将平流扩散 react 偏微分方程与 FiPy 耦合

python - 一次替换列表中的项目

python - 如何以 plotly 方式显示点网格?

python - 将 pandas 生成的图渲染到 matplotlib Canvas 以进行流式处理

python - pyplot - 有没有办法显式指定 x 和 y 轴编号?

javascript - 如何使用mpld3的LinkedBrush插件选择 "dump"点?

python - 使用 Matplotlib 和 mpld3 在 Web 浏览器上生成多个图形

matplotlib - 设置 mpld3 图的高度和宽度

python - 如何设置 axvlines 使用与 matplotlib 中的 axes.color_cycle 相同的颜色?