Reputation: 505
I have a question similar to: Python Matplotlib Y-Axis ticks on Right Side of Plot
I fixed the problem of putting y-axis ticklabels on the right side of the plot, but I would like to restore y ticks on the left side too.
I tried with:
yax.set_ticks_position('both')
but I get:
ax0.set_ticks_position('both')
AttributeError: 'AxesSubplot' object has no attribute 'set_ticks_position'
How can I solve this problem?
Upvotes: 1
Views: 1482
Reputation: 23502
You are not getting the right object on which to call set_ticks_position()
. Here's a simpler way with gca()
:
from pylab import *
figure()
plot(arange(5))
ax = gca()
ax.yaxis.tick_right()
ax.yaxis.set_ticks_position('both')
Upvotes: 2
Reputation: 2724
In the second code sample you use ax0
, which I guess is an Axes
instance, in the first code sample you use yax
, which presumably the axis-child of ax0
.
I think you're looking for tick_params: ax0.tick_params(axis = 'y', direction = 'in')
Upvotes: 1