Turn off the upper/right axis tick marks

前端 未结 4 1469
天涯浪人
天涯浪人 2020-12-17 11:16

I want to make the ticks on the right and upper axis invisible and am not sure what the third line should be:

import matplotlib.pyplot as plt
plt.plot(X,Y)
#         


        
4条回答
  •  太阳男子
    2020-12-17 11:41

    tick_params should do it.

    I don't have matplotlib installed on my current computer, so I can't test it, but this should work:

    import matplotlib.pyplot as plt
    
    ax = plt.subplot(111)
    plt.plot([0,1], [0,1])
    ax.tick_params(labeltop='off', labelright='off')
    plt.show()
    

提交回复
热议问题