如何将绘图的大小拉伸到整个形状区域

时间:2018-03-20 11:33:03

标签: python matplotlib canvas plot pyqt

我无法将情节拉伸到图的整个区域。当我调用tight_layout时,获得了绘图所需的高度,但是我无法达到所需的长度: enter image description here

enter image description here

代码:

self.figure = plt.figure()
    self.canvas = FigureCanvas(self.figure)
    # self.figure.set_figheight(15)
    # self.figure.set_figwidth(5)
    #self.figure.tight_layout()
    self.figure.set_size_inches(1, 7)
    self.graphBox.addWidget(self.canvas)

    # ------------------------------------------------------------------
    # ------------------------------------------------------------------
    t = np.arange(0.0, 2.0, 0.01)
    s = np.sin(2 * np.pi * t)
    ax = plt.subplot2grid((1, 1), (0, 0))
    ax.set_facecolor(color='#b3ff66')
    ax.plot(t, s)
    self.canvas.draw()
    #plt.tight_layout(h_pad=1.0, w_pad=1.0)
    # ------------------------------------------------------------------
    # ------------------------------------------------------------------

0 个答案:

没有答案