Matplotlib control which plot is on top

后端 未结 3 1578
长发绾君心
长发绾君心 2020-12-15 03:52

I am wondering if there is a way to control which plot lies on top of other plots if one makes multiple plots on one axis. An example:

As you can see, the g

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-15 04:43

    Use the zorder kwarg where the lower the zorder the further back the plot, e.g.

    plt.plot(series1_x, series1_y, zorder=1)
    plt.plot(series2_x, series2_y, zorder=2)
    plt.scatter(series2_x, series2_y, zorder=3)
    

提交回复
热议问题