UpSetPlot
UpSetPlot copied to clipboard
Consider new constrained_layout engine in Mpl
Towards this:
from matplotlib import pyplot as plt
gridspec_kw = {"height_ratios": [3, 8, 2], "width_ratios": [2, 8]}
fig = plt.figure()
fig.set_constrained_layout(True)
ax_arr = fig.subplots(3, 2, gridspec_kw=gridspec_kw)
fig.canvas.draw() # constrained layout optimisation
totals_ax = ax_arr[2, 0]
matrix_ax = ax_arr[2, 1]
intersection_ax = ax_arr[1, 1]
for unused_ax in ax_arr[:-1, 0]:
unused_ax.set_visible(False)
intersection_ax.set_yticks([0, 1])
intersection_ax.set_yticklabels(["Hello", "World!!!!!!!!"])
(x0, y0), _ = totals_ax.get_position().get_points()
_, (x1, y1) = matrix_ax.get_position().get_points()
shading_ax = fig.add_axes([x0, y0, x1 - x0, y1 - y0], sharey=totals_ax, in_layout=False, zorder=-1)