imshow and plot side by side
问题 I'm trying to put side-by-side numpy array displayed as image and seaborn distplot of the same array. I've came up with the following function: def visualize(arr): f, (ax1, ax2) = plt.subplots(1, 2, gridspec_kw = {'width_ratios': [1, 3]}) ax1.imshow(arr) flat = arr.flatten() x = flat[~np.isnan(flat)] sns.distplot(x, ax=ax2) plt.show() which produces: As you can see, the image has smaller height than the plot. How can I modify my function in order to have the same height for the plot and the