Python 图形绘制在半屏上
Python figure plots on half screen
我有以下代码,我真的很难在整个屏幕上显示情节。
fig = plt.figure()
fig.subplots_adjust(bottom=0.2)
ax1 = fig.add_subplot(212)
ax1.set_xlabel('Time')
ax1.set_ylim(0,time)
line1 = ax1.plot(a,'bo-',label='One')
line2 = ax1.plot(b,'mo-',label='Two')
lines = line1 + line2
labels = [l.get_label() for l in lines]
ax1.legend(lines, labels, loc=(0,-0.5), ncol=2)
plt.show()
我尝试了我在网络上找到的所有答案以及线程 Extend python plots to full screen 中的所有建议,其中 none 有效。
如有任何帮助,我们将不胜感激!
P.S。我没有使用
t = np.arange(b)
plt.plot(t, a, 'bo-')
例如,如果 x 和 y 值不同,它就不起作用,而且我无法预定义 x,因为它因我的程序而异。
行
ax1 = fig.add_subplot(212)
创建一个 2x1
情节和 returns 第二个子情节。如果你想要一个单一的情节,将这一行更改为
ax1 = fig.add_subplot(111)
即1x1
拆分返回单个子图。
我有以下代码,我真的很难在整个屏幕上显示情节。
fig = plt.figure()
fig.subplots_adjust(bottom=0.2)
ax1 = fig.add_subplot(212)
ax1.set_xlabel('Time')
ax1.set_ylim(0,time)
line1 = ax1.plot(a,'bo-',label='One')
line2 = ax1.plot(b,'mo-',label='Two')
lines = line1 + line2
labels = [l.get_label() for l in lines]
ax1.legend(lines, labels, loc=(0,-0.5), ncol=2)
plt.show()
我尝试了我在网络上找到的所有答案以及线程 Extend python plots to full screen 中的所有建议,其中 none 有效。
如有任何帮助,我们将不胜感激!
P.S。我没有使用
t = np.arange(b)
plt.plot(t, a, 'bo-')
例如,如果 x 和 y 值不同,它就不起作用,而且我无法预定义 x,因为它因我的程序而异。
行
ax1 = fig.add_subplot(212)
创建一个 2x1
情节和 returns 第二个子情节。如果你想要一个单一的情节,将这一行更改为
ax1 = fig.add_subplot(111)
即1x1
拆分返回单个子图。