Matplotlib coord. sys origin to top left

前端 未结 5 669
栀梦
栀梦 2020-12-14 09:26

How can I flip the origin of a matplotlib plot to be in the upper-left corner - as opposed to the default lower-left? I\'m using matplotlib.pylab.plot to produce the plot (

5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-14 09:49

    axis ij just makes the y-axis increase downward instead of upward, right? If so, then matplotlib.axes.invert_yaxis() might be all you need -- but I can't test that right now.

    If that doesn't work, I found a mailing post suggesting that

    setp(gca(), 'ylim', reversed(getp(gca(), 'ylim')))
    

    might do what you want to resemble axis ij.

提交回复
热议问题