Having the following code to generate matplotlib subplots:
import matplotlib.pyplot as plt
x = [1,2,3]
y = [4,5,6]
fig, ax = plt.subplots(1, 2, figsize=(10, 10))
ax[0].plot(x, y)
ax[1].plot(x, y)
I can get figure size using:
h = fig.get_figheight()
w = fig.get_figwidth()
print(h, w)
A bit surprisingly, I get 9.98 10.0
, but anyway it agrees with figsize=(10, 10). My questions is how can I get the subfigure size from axes, in this case ax[0] and ax[1] just like using fig to get the size?