set_data and autoscale_view matplotlib

后端 未结 1 1933
执念已碎
执念已碎 2020-12-08 07:41

I have multiple lines to be drawn on the same axes, and each of them are dynamically updated (I use set_data), The issue being that i am not aware of the x and y limits of e

相关标签:
1条回答
  • 2020-12-08 08:11

    From the matplotlib docs for autoscale_view:

    The data limits are not updated automatically when artist data are changed after the artist has been added to an Axes instance. In that case, use matplotlib.axes.Axes.relim() prior to calling autoscale_view.

    So, you'll need to add two lines before your plt.draw() call after the set_data call:

    axes.relim()
    axes.autoscale_view(True,True,True)
    
    0 讨论(0)
提交回复
热议问题