Python Matplotlib Y轴在图的右侧滴答
问题描述:
我有一个简单的线图,需要将y轴刻度从图的(默认)左侧移到右侧.有关如何执行此操作的任何想法?
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?
答
使用ax.yaxis.tick_right()
例如:
from matplotlib import pyplot as plt
f = plt.figure()
ax = f.add_subplot(111)
ax.yaxis.tick_right()
plt.plot([2,3,4,5])
plt.show()