Matplotlib: Adding an axes using the same arguments as a previous axes

前端 未结 5 2033
死守一世寂寞
死守一世寂寞 2020-11-27 17:22

I want to plot data, in two different subplots. After plotting, I want to go back to the first subplot and plot an additional dataset in it. However, when I do so I get this

5条回答
  •  抹茶落季
    2020-11-27 18:08

    Note that in this case, the warning is a false positive. It should ideally not be triggered in the case you use plt.subplot(..) to reactivate a subplot which has previously been created.

    The reason this warning occurs is that plt.subplot and fig.add_subplot() take the same code path internally. The warning is meant for the latter, but not the former.

    To read more about this, see issues 12513. Long story short, people are working on it, but it is not as easy as initially thought to decouple the two functions. For the moment you can just savely ignore the warning if it is triggered by plt.subplot().

提交回复
热议问题