e2nIEE / pandapower

Convenient Power System Modelling and Analysis based on PYPOWER and pandas
https://www.pandapower.org
Other
861 stars 481 forks source link

plotly | weighted marker trace - no coordinate transformation when providing `projection` to simple_plotly #1785

Open jwiemer112 opened 1 year ago

jwiemer112 commented 1 year ago

The new feature to create weighted plots which respect the generation "doesn't work" when you plot on a map and transform the geocoords in simple_plotly(). The create_weighted_marker_trace doesnt consider the projection that is passed to simple_plotly(), in the end the net is transformed but the weighted traces are not.

A quick fix is to transform the net before plotting. In perspective, the weighted_traces should also take into account the projection.

Problem code snippet:

    net = mv_oberrhein()
    net.load.scaling, net.sgen.scaling = 1, 1
    # different markers and sizemodes as examples
    markers_load = create_weighted_marker_trace(net, elm_type="load", color="red",
                                                patch_type="circle", sizemode="area",
                                                marker_scaling=100)
    markers_sgen = create_weighted_marker_trace(net, elm_type="sgen", color="green",
                                                patch_type="circle", sizemode="diameter",
                                                marker_scaling=100)

    simple_plotly(net, bus_size=1, on_map=True, projection="epsg:31467", additional_traces=[markers_load, markers_sgen])

Quick Fix code snippet:

    net = mv_oberrhein()

    # transformation before plotting
    geo_data_to_latlong(net, projection="epsg:31467")

    net.load.scaling, net.sgen.scaling = 1, 1

    # different markers and sizemodes as examples
    markers_load = create_weighted_marker_trace(net, elm_type="load", color="red",
                                                patch_type="circle", sizemode="area",
                                                marker_scaling=100)
    markers_sgen = create_weighted_marker_trace(net, elm_type="sgen", color="green",
                                                patch_type="circle", sizemode="diameter",
                                                marker_scaling=100)

    simple_plotly(net, bus_size=1, on_map=True, additional_traces=[markers_load, markers_sgen])
rbolgaryn commented 1 year ago

what is the status of the issue @jwiemer112 ?