【问题标题】:Python figure plots on half screenPython图形在半屏上绘制
【发布时间】:2017-10-09 19:17:45
【问题描述】:

我有以下代码,我真的很难在整个屏幕上显示情节。

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中的所有建议,但都没有奏效。

任何帮助将不胜感激!

附:我没有使用

t = np.arange(b)
plt.plot(t, a, 'bo-')

例如,如果 x 和 y 值不同,它就不起作用,并且我无法预定义 x,因为它因我的程序而异。

【问题讨论】:

  • 全屏是什么意思?你想要一个像ax1 = fig.add_subplot(111)这样的子图吗?
  • @sauerburger 是的,这就是我所追求的!!感谢您的帮助!我遇到过这个例子pythonprogramming.net/… 并被抛弃相信'212'代表完全不同的东西......

标签: python plot fullscreen figure subplot


【解决方案1】:

线

ax1 = fig.add_subplot(212)

创建一个2x1 图并返回第二个子图。如果你想要一个单一的情节,把这条线改成

ax1 = fig.add_subplot(111)

1x1 split 返回单个子图。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-09-22
    • 2011-01-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多