Я полагаю, что вы можете выполнить sh то, что вы хотите, используя GridSpe c. Следующий код должен производить то, что вы хотите, используя смоделированные данные:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
# Fake data
np.random.seed(20200319)
left_data = np.random.randint(low = 0, high = 1000, size = (161, 1))
right_data = np.random.randint(low = 0, high = 1000, size = (339, 1))
left_data = np.random.randn(161, 1) * 191.3 + 367.3
right_data = np.random.randn(339, 1) * 189.1 + 369.5
# Create a figure and two main subplots
f = plt.figure()
gs = gridspec.GridSpec(1, 2, figure=f)
# Create subplots for the Left subplot
gs_left = gridspec.GridSpecFromSubplotSpec(2, 1, subplot_spec = gs[0])
ax_left_box = f.add_subplot(gs_left[0, :])
ax_left_hist = f.add_subplot(gs_left[1, :], sharex = ax_left_box)
# Create subplots for the right subplot
gs_right = gridspec.GridSpecFromSubplotSpec(2, 1, subplot_spec = gs[1])
ax_right_box = f.add_subplot(gs_right[0, :])
ax_right_hist = f.add_subplot(gs_right[1, :], sharex = ax_right_box)
# Populate with data
ax_left_box.boxplot(left_data, vert = False)
ax_left_hist.hist(left_data, bins = np.arange(0,1001,20), density = True)
ax_right_box.boxplot(right_data, vert = False)
ax_right_hist.hist(right_data, bins = np.arange(0,1001,20), density = True)
# Formatting
ax_left_box.set_xlim((-200, 1200))
ax_left_box.set_xticks(np.arange(-200, 1201, 200))
ax_left_hist.set_ylim((0, 0.004))
ax_left_hist.set_xlabel("call_duration_per_month")
ax_right_box.set_xlim((-200, 1200))
ax_right_box.set_xticks(np.arange(-200, 1201, 200))
ax_right_hist.set_ylim((0, 0.004))
ax_right_hist.set_xlabel("call_duration_per_month")
plt.suptitle("The main title")