How do I let my matplotlib plot go beyond the axes?

前端 未结 3 1881
太阳男子
太阳男子 2020-12-30 21:53

I have to translate an image plotting script from matlab to matplotlib/pylab, and I\'m trying to achieve the same effect as the matlab image below:

3条回答
  •  春和景丽
    2020-12-30 22:18

    To get the marker to show beyond the axes you can turn the clipping off. This can be done using the keyword argument in the plot command clip_on=False.

    For example:

    import matplotlib.pyplot as plt
    plt.plot(range(5), range(5), 'ro', markersize=20, clip_on=False, zorder=100)
    plt.show()
    

    enter image description here

提交回复
热议问题