Home > Enterprise >  Matplotlib plot shows 2 labels on the y-axis
Matplotlib plot shows 2 labels on the y-axis

Time:06-05

I am trying to generate a continously generated plot in matplotlib. The problem that I am facing is related to the labelling on the right y-axis. The range that shows is my desired, however there is also an additional set off labels (0, 0.2, ... 1,0).

def doAnimation():
    fig, ax = plt.subplots()

    def animate(i):
        data=prices(a,b,c)  #this gives a DataFrame with 2 columns (value 1 and 2)

        plt.cla()
        ax.plot(data.index, data.value1)
        ax2 = ax.twinx()
        ax2.plot(data.index, data.value2)
        plt.gcf().autofmt_xdate()     
        plt.tight_layout()  
        return ax, ax2

    call = FuncAnimation(plt.gcf(), animate, 1000)  
    return call

callSave = doAnimation()
plt.show()

Any ideas how can I get rid of the set: 0.0, 0.2, 0.4, 0.6, 0.8, 1.0?

This is how the graph looks: enter image description here

CodePudding user response:

animation.gif

  • Related