// get the aspect_ratio we want to display
aspect_ratio_image = self.xaxis.size / self.yaxis.size * self._aspect
clipped_rcParams_figsize = np.array(
plt.rcParams["figure.figsize"]).clip(min_size, max_size)
// Find which direction should be limited by rcParams
if aspect_ratio_image < wfactor: // max size defined by height
max_size = clipped_rcParams_figsize[1]
figsize = (max_size * aspect_ratio_image, max_size)
else: // max size defined by width
max_size = clipped_rcParams_figsize[0]
figsize = (max_size, max_size / aspect_ratio_image)