I'd like to add labels to a grid of plots, only at the most bottom axes. I don't get the originally created axes, so I have to query them by fig.get_axes()
(this means for the example below: I can not access the value ax
). Nevertheless all of these axes have been created by subplots with a shared x-axis.
As an example use this simplified example:
# This is just for illustration purpose I have no
# knowledge how the original plot was created
import numpy as np
import pylab as plt
fig, ax = plt.subplots(2, 3, sharex=True)
x = np.arange(0, 5, 0.1)
n = 0
for i in xrange(2):
for j in xrange(3):
y = x ** n
ax[i, j].plot(x, y)
n += 1
# My real work starts here
axes = fig.get_axes()
print axes
plt.show()
I'd now like to use the data retrieved in axes to get the three bottom axes and label them. Note: The number of columns may vary and is unknown.