import matplotlib import matplotlib.pyplot as plt months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun"] revenue = [62, 68, 71, 86, 91, 88] x = list(range(1, len(months) + 1)) fig, ax = plt.subplots(figsize=(6, 3.5), layout="constrained") ax.plot(x, revenue, marker="o", linewidth=2.5, color="#2563eb") ax.set_xticks(x, months) ax.set_ylabel("Revenue (USD thousands)") ax.set_title("Quarterly campaign revenue") ax.grid(True, axis="y", color="#e5e7eb") ax.set_ylim(55, 100) annotation = ax.annotate( "Peak month\n91k", xy=(5, 91), xytext=(32, 26), textcoords="offset points", arrowprops={"arrowstyle": "->", "color": "#1f2937", "linewidth": 1.3}, bbox={"boxstyle": "round,pad=0.3", "fc": "#fef3c7", "ec": "#92400e"}, ha="left", va="bottom", ) fig.savefig("annotation-add.png", dpi=160) print(f"matplotlib {matplotlib.__version__}") print(f"annotation text: {annotation.get_text().replace(chr(10), ' / ')}") print(f"annotation xy data: {annotation.xy}") print(f"text offset points: {annotation.get_position()}") print("saved annotation-add.png")