In the following code I attempt to plot right and left
> yaxis labels each with its own color. The left axis comes
> out OK - red, medium The right axis comes out the default.
> I have tried everything I could think of (admittedly not
> much) to alter any property of the right labels and have
> had no success - How do I alter the right axis label
> properties in the example below??? thanks for any help.
Hi Jim,
Avoiding for now the question of what the proper interface should be
for accessing the left and right (or top and bottom) tick properties
in general, here's a quick fix that will give you access to all of the
tick labels for a give axis
In matplotlib.axis.py, replace the get_ticklabels method with
def get_ticklabels(self):
'Return a list of Text instances for ticklabels'
labels1 = [tick.label1 for tick in self.get_major_ticks() if tick.label1On]
labels2 = [tick.label2 for tick in self.get_major_ticks() if tick.label2On]
return labels1+labels2
The current behavior was to just return the label1 instances (left for
xaxis, bottom for yaxis).
Perhaps the best solution is to add an optional arg to all the
get_tick* methods
labels = ax.get_xticklabels() # get all
labels = ax.get_xticklabels('left') # get left labels
labels = ax.get_xticklabels('right') # get right labels
and so on for get_xticks, get_xticklines and the y and set* analogs.
JDH