from pathlib import Path import matplotlib.pyplot as plt response_hours = [ 4, 5, 5, 6, 7, 7, 8, 9, 9, 9, 10, 11, 12, 12, 13, 14, 15, 16, 18, 20, 22, 25, 28, 31, ] bin_edges = [0, 5, 10, 15, 20, 25, 30, 35] fig, ax = plt.subplots(figsize=(7, 4.5), layout="constrained") counts, edges, patches = ax.hist( response_hours, bins=bin_edges, color="tab:blue", edgecolor="white", ) ax.set_title("Support ticket response times") ax.set_xlabel("Hours to first response") ax.set_ylabel("Ticket count") ax.set_xticks(bin_edges) ax.grid(axis="y", linestyle=":", alpha=0.5) output = Path("ticket-response-histogram.png") fig.savefig(output, dpi=160) plt.close(fig) print(f"bins: {len(edges) - 1}") print(f"counts: {[int(count) for count in counts]}") print(f"x label: {ax.get_xlabel()}") print(f"y label: {ax.get_ylabel()}") print(f"saved: {output}") print(f"bytes: {output.stat().st_size}")