Code Duplication    Length = 21-24 lines in 2 locations

src/egon/data/datasets/heat_supply/individual_heating.py 1 location

@@ 1089-1112 (lines=24) @@
1086
    return df_profile_merge.loc[:, columns]
1087
1088
1089
def plot_heat_supply(resulting_capacities):
1090
    from matplotlib import pyplot as plt
1091
1092
    mv_grids = db.select_geodataframe(
1093
        """
1094
        SELECT * FROM grid.egon_mv_grid_district
1095
        """,
1096
        index_col="bus_id",
1097
    )
1098
1099
    for c in ["CHP", "heat_pump"]:
1100
        mv_grids[c] = (
1101
            resulting_capacities[resulting_capacities.carrier == c]
1102
            .set_index("mv_grid_id")
1103
            .capacity
1104
        )
1105
1106
        fig, ax = plt.subplots(1, 1)
1107
        mv_grids.boundary.plot(linewidth=0.2, ax=ax, color="black")
1108
        mv_grids.plot(
1109
            ax=ax,
1110
            column=c,
1111
            cmap="magma_r",
1112
            legend=True,
1113
            legend_kwds={
1114
                "label": f"Installed {c} in MW",
1115
                "orientation": "vertical",

src/egon/data/datasets/heat_supply/district_heating.py 1 location

@@ 477-497 (lines=21) @@
474
    return df
475
476
477
def plot_heat_supply(resulting_capacities):
478
    from matplotlib import pyplot as plt
479
480
    district_heating_areas = select_district_heating_areas("eGon2035")
481
482
    for c in ["CHP", "solar_thermal_collector", "geo_thermal", "heat_pump"]:
483
        district_heating_areas[c] = (
484
            resulting_capacities[resulting_capacities.carrier == c]
485
            .set_index("district_heating_id")
486
            .capacity
487
        )
488
489
        fig, ax = plt.subplots(1, 1)
490
        district_heating_areas.boundary.plot(
491
            linewidth=0.2, ax=ax, color="black"
492
        )
493
        district_heating_areas.plot(
494
            ax=ax,
495
            column=c,
496
            cmap="magma_r",
497
            legend=True,
498
            legend_kwds={
499
                "label": f"Installed {c} in MW",
500
                "orientation": "vertical",