我要绘制的值未显示在图中

所以我猜想这将是重复的,但是我找不到想要的答案。 我遇到的问题并不是很大,但是我似乎无法弄清楚出了什么问题。

我将日期时间对象的ndarray作为xvalue,将浮点值的ndarray作为yvalue。

def drawWindow():

    # Getting our root window in tkinter
    root = tkin.Tk()

    # Selecting the figure type
    fig = plt.figure(1)

    # Setting the plot on interactive so it can be updated
    plt.ion()

    xValues = np.array([guiClass.__getX__("1/9/2019","2/11/2019")])
    yValues = np.array([guiClass.__getY__("temperatuurGC ","1/9/2019","2/11/2019")])

    plt.plot(xValues,yValues) # X values,Y values
    canvas = FigureCanvasTkAgg(fig,master=root)
    plotWidget = canvas.get_tk_widget()

def update():
     yValues = np.array([guiClass.__getY__("temperatuurGC ","2/11/2019")])         
    plt.plot(xValues,yValues)
    fig.canvas.draw()

    plotWidget.grid(row=0,column=0)
    tkin.Button(root,text="Update",command=update).grid(row=1,column=1)
    root.mainloop()

在此示例中,yValues ndarray中的值为[10.7,10.5,10.,9.7,9.9,9.8,9.9]

我的输出是here

我希望在图表中显示我的值,但是它不能以我尝试的方式起作用,我在做什么错了?

shong29 回答:我要绘制的值未显示在图中

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3159511.html

大家都在问