from matplotlib import pyplot as plt
import matplotlib.gridspec as gridspec
import numpy as np
x = np.random.geometric(0.001, size=500)
y = np.random.normal(size=500)
plt.figure()
gs = gridspec.GridSpec(2, 2,
width_ratios=[1, 3],
height_ratios=[3, 1])
ax_vertical_hist = plt.subplot(gs[0])
ax_main_plot = plt.subplot(gs[1])
ax_horizontal_hist = plt.subplot(gs[3])
ax_vertical_hist.hist(y, orientation='horizontal')
ax_main_plot.scatter(x, y)
ax_horizontal_hist.hist(x)
ax_main_plot.set_axis_off()
plt.tight_layout(w_pad=0, h_pad=0)
plt.show()