From 85d932e23e53e013da5d593a6a3561c0ee1f3fe7 Mon Sep 17 00:00:00 2001 From: Lukas Grossberger Date: Thu, 27 Jun 2024 21:35:28 +0200 Subject: [PATCH] disable state border plotting due to missing data --- main.py | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/main.py b/main.py index ab32437..227ebe4 100644 --- a/main.py +++ b/main.py @@ -28,27 +28,23 @@ def main( data.loc[data["plz"].str.startswith(plz_prefix), "highlighted"] = True # TODO: This should instead be a proper geo spatial projection - coordinate_transform = np.array([[1.0, 1.6]]).T + coordinate_transform = np.array([[1.0, 1.0]]).T ax = plt.axes(aspect="equal") - for bundesland in data["bundesland"].unique(): - bundesland_df = data[data["bundesland"] == bundesland] - union = bundesland_df.unary_union + union = data.unary_union + for geom in getattr(union, "geoms", [union]): + ax.fill( + *geom.exterior.xy, + fc=map_background_color, + ec=image_background_color, + linewidth=0.1, + ) + + if any(data["highlighted"]): + union = data[data["highlighted"]].unary_union for geom in getattr(union, "geoms", [union]): ax.fill( - *(geom.exterior.xy * coordinate_transform), - fc=map_background_color, - ec=image_background_color, - linewidth=0.1, - ) - - if not any(bundesland_df["highlighted"]): - continue - - union = bundesland_df[bundesland_df["highlighted"]].unary_union - for geom in getattr(union, "geoms", [union]): - ax.fill( - *(geom.exterior.xy * coordinate_transform), + *geom.exterior.xy, fc=map_accent_color, ec=None, )