将python图扩展到全屏 [英] Extend python plots to full screen
问题描述
我想将我使用mpld3绘制的python图扩大到全屏显示.由于以下原因,我希望使用mpld3
I want to extent the python plots I am plotting using mpld3 to full screen. I wish to use mpld3 due to the following reasons
- 我希望大约有4个图,并且每个图都有缩放选项.
- 所有绘图必须显示在同一个窗口中.
在这里,我尝试使用tight_layout选项将图扩展到全屏显示,但是它不能如最后的链接所示工作.我猜tight_layout不适用于mpld3.还有其他方法可以使其全屏显示吗?
Here, I tried using tight_layout option to extend the plots to occupy full screen but it does not work as shown in the link at the end.I guess tight_layout does not work with mpld3. Is there any other way to make it stretch to full screen?
此外,如何在要绘制的屏幕上添加文本?就像这4个地块从上到下占据了屏幕的90%,而文本在底部占据了剩余的10%?
Also,how do I add text to the screen where am plotting? Like the 4 plots occupying 90% of the screen from top to bottom and the text occupying remaining 10% at the bottom?
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()
- 检查此链接以获取代码的输出 http://i.stack.imgur.com/4mBRI.png
推荐答案
fig.set_size_inches(x_val,y_val)
帮助我调整绘图大小以适应屏幕
helped me resize the plot to fit the screen
这篇关于将python图扩展到全屏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!