from pathlib import Path import numpy as np import matplotlib.pyplot as plt output = Path("layout-fix-overlap.png") months = np.arange(1, 7) month_labels = [ "January", "February", "March", "April", "May", "June", ] regions = { "North support queue": [42, 38, 47, 51, 49, 55], "South support queue": [31, 35, 34, 39, 44, 46], "East support queue": [28, 33, 37, 36, 41, 43], "West support queue": [36, 32, 40, 45, 47, 50], } fig, axs = plt.subplots(2, 2, figsize=(8.6, 5.4), layout="constrained") fig.suptitle("Support ticket backlog with readable labels", fontsize=15) last_points = None for index, (ax, (region, tickets)) in enumerate(zip(axs.flat, regions.items())): risk_score = np.linspace(35 + index * 6, 78 + index * 4, len(months)) last_points = ax.scatter( months, tickets, c=risk_score, cmap="viridis", vmin=30, vmax=95, s=72, edgecolor="black", linewidth=0.4, ) ax.plot(months, tickets, color="0.30", linewidth=1.4) ax.set_title(region) ax.set_xlabel("Month reviewed") ax.set_ylabel("Tickets pending triage") ax.set_xticks(months, month_labels, rotation=35, ha="right") ax.grid(True, alpha=0.25) fig.colorbar(last_points, ax=axs, label="SLA risk score") fig.savefig(output, dpi=160) engine = fig.get_layout_engine() print(f"layout engine: {engine.__class__.__name__}") print(f"saved: {output.name}")