Is there any way to assign multiple xlabels at once in matplotlib?

Viewed 1703

I want to assign multiple xlabels at once in matplotlib. Now I assign multiple xlabels as follows.

import matplotlib.pyplot as plt

fig1 = plt.figure()
ax1 = fig1.add_subplot(211)
ax1.set_xlabel("x label")
ax2 = fig1.add_subplot(212)
ax2.set_xlabel("x label")

I feel this way is redundant. Is there any way to assign multiple xlabels at once like follows?

(ax1,ax2).set_xlabel("x label")
3 Answers
Related