Python Matplotlib Y轴在图的右侧滴答 [英] Python Matplotlib Y-Axis ticks on Right Side of Plot

查看:596
本文介绍了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()

这篇关于Python Matplotlib Y轴在图的右侧滴答的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆