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?
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
- Correctly parse PDF paragraphs with Python
Use
ax.yaxis.tick_right()
for example:
For right labels use
ax.yaxis.set_label_position("right")
, i.e.:joaquin's answer works, but has the side effect of removing ticks from the left side of the axes. To fix this, follow up
tick_right()
with a call toset_ticks_position('both')
. A revised example:The result is a plot with ticks on both sides, but tick labels on the right.
Just is case somebody asks (like I did), this is also possible when one uses subplot2grid. For example:
It will show this: