I am trying to include a figure text outside the plot @(0.15, -0.25). This works in a normal chart. But when I try yo animate this, it gets eliminated. Basically anything that is outside the plot (perhaps with a tolerance margin) is getting eliminated, since I see the same issue with legend in bbox outside the plot. I am not able to figure out how set_animated flag is supposed to work.
Here is the extract of the relevant code. Will be happy if someone can help me with this.
rgds
Nitin
ftext = plt.figtext(0.15,-0.05,footnote, {'fontsize': 8})
ftext.set_animated(False)
def init():
ftext.set_text("")
ftext.set_position((1.1,-0.5))
ftext.set_animated(False)
return fig, ftext
def animate(i):
if i == 0:plt.cla()
df.iloc[:,i].plot( ax=ax, color = colors[i], marker = marker[i], xlabel=xlabel,ylim=limy)
if ylabel != ' ': ax.set_ylabel(ylabel)
if legend == 'y': ax.legend(bbox_to_anchor=(0, 1.03, 1, 0), loc="lower left", mode="expand", ncol= ncol)
ax.set_title(title, pad = 1)
ftext.set_text("footnote")
ftext.set_position((0.15,-0.25))
ftext.set_animated(False)
return fig, ftext
anim = FuncAnimation(fig, animate, init_func = init, frames=6, interval=500, repeat=False)
anim.save(savfyl+".gif", writer='ffmpeg')