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