![]() |
爱搭讪的红金鱼 · Fonts Matplotlib ...· 2 月前 · |
![]() |
逃跑的槟榔 · Microsoft ...· 8 月前 · |
![]() |
八块腹肌的啤酒 · 酷派大神F2销量揭秘:日销两万台总量破50万 ...· 1 年前 · |
![]() |
热情的硬币 · 克罗斯退出德国国家队:感谢勒夫,今后我将专注 ...· 2 年前 · |
|
天涯 · 老程序员解 bug 有哪些通用套路? - 知乎· 2 年前 · |
![]() |
why7812 · 8本有趣好看的破案言情小说,剧情环环相扣,故 ...· 5 年前 · |
我有一个简单的线状图,需要将y轴刻度从(默认)左侧移到右侧。对如何做到这一点有什么想法吗?
使用
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()
对于右侧标签,请使用
ax.yaxis.set_label_position("right")
,即:
f = plt.figure()
ax = f.add_subplot(111)
ax.yaxis.tick_right()
ax.yaxis.set_label_position("right")
plt.plot([2,3,4,5])
ax.set_xlabel("$x$ /mm")
ax.set_ylabel("$y$ /mm")
plt.show()
|
天涯 · 老程序员解 bug 有哪些通用套路? - 知乎 2 年前 |