matplotlib not able to plot different labels for different live graph

pbwdgjma  于 2023-02-23  发布在  其他
关注(0)|答案(1)|浏览(183)

actually trying to make 4 different live graphs using mat plot lib but its but they don't have their own x and y labels want all of them to be completely different using subplot but don't know what going wrong. make 4 subplots and plot them accprding to right syntax
I try them to by defining ax[j, k]. xaxis the graph are working well but they don't have their own x and y label i try different method but all get me a problem fig, self.ax = plt.subplots(2, 2, sharex='all', sharey='all')

canvas = FigureCanvasTkAgg(fig, master=frame1)
    canvas.draw()
    canvas.get_tk_widget().pack()
    global x,y1

    self.x = np.linspace(0, 4, 241)
    x = []
    y1 = []
    t = []

    def animate(i, x, y1):

        
            temp_c = self.var

            
            x.append(i)
            y1.append(temp_c)

            for j in range(2):
                for k in range(2):
                    self.ax[j, k].clear()

                    
                    self.ax[j, k].plot(x, y1, linewidth=2)

    ani = animation.FuncAnimation(fig, animate, fargs=(x, y1), interval=1000)
    # plt.tight_layout()
    plt.show()
krcsximq

krcsximq1#

You can use ax[j, k].set_xlabel("your-x-label") and ax[j, k].set_ylabel("your-y-label") for every subplot and set different labels for them.

相关问题