I want to choose the color for certain buses in the graph of a pandapower network. I use the simple_plotly
function from pandapower, which works well. As a next step I use create_bus_trace
here to crate a trace. Finally I use draw_traces
here to draw those buses.
PROBLEM:
The trace appears in a separate plot. But I want the trace to be in the same plot as that, created with simple_plotly(net)
Here is, what my code looks like:
import numpy as np
import pandapower.plotting as pt
import pandapower as pp
import pandapower.networks as pn
net = pn.create_kerber_vorstadtnetz_kabel_1()
pt.simple_plotly(net)
color_buses = np.random.choice(net.bus.index, 33)
color_trace = pt.plotly.create_bus_trace(net, color_buses, color='red',
trace_name='special buses')
pt.plotly.draw_traces(color_trace)
Any ideas, how to get both traces into one plot?
Thank you for any help in advance!
I have found a solution:
So the trick was to directly work with the object returned by
simple_plotly
and useadd_trace
.I also had to tell plotly.io to use the browser as standard renderer for the updated plot to appear on
fig.show()
.This is what it looks like: