Python Matplotlib Y-Axis ticks on Right Side of Plot

后端 未结 4 1775
傲寒
傲寒 2020-11-30 20:51

I have a simple line plot and need to move the y-axis ticks from the (default) left side of the plot to the right side. Any thoughts on how to do this?

4条回答
  •  南笙
    南笙 (楼主)
    2020-11-30 20:56

    Just is case somebody asks (like I did), this is also possible when one uses subplot2grid. For example:

    import matplotlib.pyplot as plt
    plt.subplot2grid((3,2), (0,1), rowspan=3)
    plt.plot([2,3,4,5])
    plt.tick_params(axis='y', which='both', labelleft='off', labelright='on')
    plt.show()
    

    It will show this:

    enter image description here

提交回复
热议问题