-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Calling savefig() changes the return value of ax.get_xticklabels() #6800
Copy link
Copy link
Closed
Labels
Milestone
Description
matplotlib 1.5.1 on Linux, installed from binary package, both on Python 3.5.2 and 2.7.12.
Here is the code:
import pylab
f, axes = pylab.subplots(2, sharex=True, sharey=True)
for ax in axes:
ax.plot(range(100))
for ax in axes:
print([x.get_text() for x in ax.get_xticklabels()])
print('----')
pylab.savefig('/tmp/tempfig.png')
for ax in axes:
print([x.get_text() for x in ax.get_xticklabels()])The output is:
['', '', '', '', '', '']
['', '', '', '', '', '']
----
['0', '20', '40', '60', '80', '100']
['0', '20', '40', '60', '80', '100']
If I comment out the call to savefig(), I get
['', '', '', '', '', '']
['', '', '', '', '', '']
----
['', '', '', '', '', '']
['', '', '', '', '', '']
The tick labels (which I am trying to get) are seen in the figure:
Is this expected?
Reactions are currently unavailable
