X Tutup
Skip to content

plt.text object updating incorrectly with blit=False #6670

@snelltheta

Description

@snelltheta

I have a FuncAnimation that is using a plt.text object to display the i-th column of my time_data array.
It looks great when blit=true, but when I save the file as a movie or make blit=false, the text overwrites itself. Since my goal is making a movie, I wish there was a way to make blit=true for the save function.

blit=True

blit=True

blit=False

blit=False, and also a movie

Basically, the code is this

#raw_data is a 2-D array where the 0th column is the data to display
def init():
    line.set_data([], [])
    return line,
def animate(i):
    x = np.linspace(lower_bound,upper_bound,upper_bound-lower_bound)
    y = raw_data[i,lower_bound:upper_bound]
    line.set_data(x, y)
    time_stamp=plt.text(0.5,0.1,time_data[i],verticalalignment='center',
                        horizontalalignment='left',
                        transform=ax.transAxes,fontsize=15)
    return time_stamp, line,
    anim = animation.FuncAnimation(fig, animate, init_func=init,
                               frames=200, interval=110, blit=True)

    anim.save('basic_animation.mp4', fps=30, extra_args=['-vcodec', 'libx264'])

MPL version 1.5.2rc2
Installed from Debian apt repository

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      X Tutup