0

I know of "Why doesn't the second x-axis tick label rotate?" but I think it's not related. I may be wrong.


I have this, in the IPython console

In [1]: from matplotlib.pyplot import subplot
   ...: from pprint import pprint
   ...: 
   ...: ax = subplot()
   ...: pprint([l.get_transform() for l in ax.yaxis.get_ticklabels()])
   ...: print()
   ...: ax.set_ylim(-205,105)
   ...: pprint([l.get_transform() for l in ax.yaxis.get_ticklabels()])
   ...: print()
   ...: ax.set_yticks((-200, 0, 100))
   ...: pprint([l.get_transform() for l in ax.yaxis.get_ticklabels()])
Installed qt5 event loop hook.
[<matplotlib.transforms.CompositeGenericTransform object at 0x7f35101ebd90>,
 <matplotlib.transforms.CompositeGenericTransform object at 0x7f35101eaa50>,
 <matplotlib.transforms.CompositeGenericTransform object at 0x7f35101ebd90>,
 <matplotlib.transforms.CompositeGenericTransform object at 0x7f35101ebd90>,
 <matplotlib.transforms.CompositeGenericTransform object at 0x7f35101ebd90>,
 <matplotlib.transforms.CompositeGenericTransform object at 0x7f35101ebd90>]

[<matplotlib.transforms.CompositeGenericTransform object at 0x7f35101ebd90>,
 <matplotlib.transforms.CompositeGenericTransform object at 0x7f35101eaa50>,
 <matplotlib.transforms.CompositeGenericTransform object at 0x7f35101ebd90>,
 <matplotlib.transforms.CompositeGenericTransform object at 0x7f35101ebd90>,
 <matplotlib.transforms.CompositeGenericTransform object at 0x7f35101ebd90>,
 <matplotlib.transforms.CompositeGenericTransform object at 0x7f35101ebd90>,
 <matplotlib.transforms.CompositeGenericTransform object at 0x7f35101ebd90>,
 <matplotlib.transforms.CompositeGenericTransform object at 0x7f35101ebd90>,
 <matplotlib.transforms.CompositeGenericTransform object at 0x7f35101ebd90>]

[<matplotlib.transforms.CompositeGenericTransform object at 0x7f35101ebd90>,
 <matplotlib.transforms.CompositeGenericTransform object at 0x7f35101eaa50>,
 <matplotlib.transforms.CompositeGenericTransform object at 0x7f35101ebd90>]

In [2]: 

As you can see, all the labels have the same transform, at 0x7f35101ebd90, EXCEPT for the second labels that have the same, different transform at 0x7f35101eaa50.

I'm just curious if there is a reason to distinguish the second tick label from the others.


For your convenience, the code w/o the prompts

from matplotlib.pyplot import subplot
from pprint import pprint

ax = subplot()
pprint([l.get_transform() for l in ax.yaxis.get_ticklabels()])
print()
ax.set_ylim(-205,105)
pprint([l.get_transform() for l in ax.yaxis.get_ticklabels()])
print()
ax.set_yticks((-200, 0, 100))
pprint([l.get_transform() for l in ax.yaxis.get_ticklabels()])
jared
  • 4,165
  • 1
  • 8
  • 31
gboffi
  • 22,939
  • 8
  • 54
  • 85

0 Answers0