From f8b4611c069d059987c6c603e40f0877d95bd6cd Mon Sep 17 00:00:00 2001 From: codex-bot Date: Tue, 26 Aug 2025 23:10:40 -0500 Subject: [PATCH] =?UTF-8?q?viz:=20always=20rotate=20x-axis=20labels=2045?= =?UTF-8?q?=C2=B0=20to=20prevent=20overlap=20(keep=20tick=20density)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/banlist_metrics.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/scripts/banlist_metrics.py b/scripts/banlist_metrics.py index 9ca86c1..2055082 100644 --- a/scripts/banlist_metrics.py +++ b/scripts/banlist_metrics.py @@ -112,16 +112,21 @@ def write_chart(snaps: List[Snapshot], image_path: str) -> None: ax.set_ylabel("IP count") ax.grid(True, linestyle=":", linewidth=0.5) - # Reduce x-axis label crowding + # Reduce x-axis label crowding; keep ticks but rotate labels for readability try: locator = mdates.AutoDateLocator(minticks=4, maxticks=8) formatter = mdates.ConciseDateFormatter(locator) ax.xaxis.set_major_locator(locator) ax.xaxis.set_major_formatter(formatter) except Exception: - # Fallback: rotate labels if ConciseDateFormatter isn't available + pass + + # Always rotate for readability regardless of formatter availability + try: + fig.autofmt_xdate(rotation=45, ha="right") + except Exception: for label in ax.get_xticklabels(): - label.set_rotation(30) + label.set_rotation(45) label.set_horizontalalignment("right") # Add slight horizontal margins to prevent clipping at edges