e2nIEE / pandapower

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

issue on ploting and version #894

Closed hitchenzhe closed 3 years ago

hitchenzhe commented 4 years ago

Dear all

When I run: import pandapower as pp

print(pp.version)

It shows <module 'packaging.version' from '/home/zhe/.local/lib/python3.6/site-packages/packaging/version.py'> And the ploting of network doesn't return any figure.

I use pandapower 2.3.1. Other calculation functions work well.

Best

lthurner commented 4 years ago

Try

import matplotlib.pyplot as plt plt.show()

after plotting?

hitchenzhe commented 4 years ago

Try

import matplotlib.pyplot as plt plt.show()

after plotting?

Dear staff, plt works. But another problem I meet is the plotly doesn.t work: simple_plotly(net) pf_res_plotly(net, figsize=2, filename=dnet+'_b1.html')

It shows following while return nothing No or insufficient geodata available --> Creating artificial coordinates. This may take some time...

Best

lthurner commented 4 years ago

Maybe you don't have all the relevant packages installed. You will need plotly as well as the pacakges necessary to create artificial coordinates: https://pandapower.readthedocs.io/en/v2.3.1/plotting/matplotlib/generic.html

hitchenzhe commented 4 years ago

Maybe you don't have all the relevant packages installed. You will need plotly as well as the pacakges necessary to create artificial coordinates: https://pandapower.readthedocs.io/en/v2.3.1/plotting/matplotlib/generic.html

Yes, I have installed python-igraph but no pycairo(maybe not necessary).

When I run pp.plotting.simple_plotly(net) individually, it returned:

`!pp.plotting.simple_plotly(net)

Figure({ 'data': [{'hoverinfo': 'text', 'line': {'color': 'rgb(128, 128, 128)', 'width': 1}, 'mode': 'lines', 'name': 'lines', 'type': 'scatter', 'x': [0.0, 0.5, 1.0], 'y': [0.0, 0.0, 0.0]}, {'hoverinfo': 'text', 'line': {'color': 'rgb(128, 128, 128)', 'width': 1}, 'mode': 'lines', 'name': 'lines', 'type': 'scatter', 'x': [1.0, 1.5, 2.0], 'y': [0.0, -0.375, -0.75]}, {'hoverinfo': 'text', 'line': {'color': 'rgb(128, 128, 128)', 'width': 1}, 'mode': 'lines', 'name': 'lines', 'type': 'scatter', 'x': [2.0, 2.5, 3.0], 'y': [-0.75, -1.0, -1.25]}, {'hoverinfo': 'text', 'line': {'color': 'rgb(128, 128, 128)', 'width': 1}, 'mode': 'lines', 'name': 'lines', 'type': 'scatter', 'x': [3.0, 3.5, 4.0], 'y': [-1.25, -1.25, -1.25]}, {'hoverinfo': 'text', 'line': {'color': 'rgb(128, 128, 128)', 'width': 1}, 'mode': 'lines', 'name': 'lines', 'type': 'scatter', 'x': [4.0, 4.5, 5.0], 'y': [-1.25, -1.25, -1.25]}, {'hoverinfo': 'text', 'line': {'color': 'rgb(128, 128, 128)', 'width': 1}, 'mode': 'lines', 'name': 'lines', 'type': 'scatter', 'x': [5.0, 5.5, 6.0], 'y': [-1.25, -1.5, -1.75]}, {'hoverinfo': 'text', 'line': {'color': 'rgb(128, 128, 128)', 'width': 1}, 'mode': 'lines', 'name': 'lines', 'type': 'scatter', 'x': [6.0, 6.5, 7.0], 'y': [-1.75, -1.75, -1.75]}, {'hoverinfo': 'text', 'line': {'color': 'rgb(128, 128, 128)', 'width': 1}, 'mode': 'lines', 'name': 'lines', 'type': 'scatter', 'x': [7.0, 7.5, 8.0], 'y': [-1.75, -1.75, -1.75]}, {'hoverinfo': 'text', 'line': {'color': 'rgb(128, 128, 128)', 'width': 1}, 'mode': 'lines', 'name': 'lines', 'type': 'scatter', 'x': [8.0, 8.5, 9.0], 'y': [-1.75, -1.75, -1.75]}, {'hoverinfo': 'text', 'line': {'color': 'rgb(128, 128, 128)', 'width': 1}, 'mode': 'lines', 'name': 'lines', 'type': 'scatter', 'x': [9.0, 9.5, 10.0], 'y': [-1.75, -1.75, -1.75]}, {'hoverinfo': 'text', 'line': {'color': 'rgb(128, 128, 128)', 'width': 1}, 'mode': 'lines', 'name': 'lines', 'type': 'scatter', 'x': [10.0, 10.5, 11.0], 'y': [-1.75, -1.75, -1.75]}, {'hoverinfo': 'text', 'line': {'color': 'rgb(128, 128, 128)', 'width': 1}, 'mode': 'lines', 'name': 'lines', 'type': 'scatter', 'x': [11.0, 11.5, 12.0], 'y': [-1.75, -1.75, -1.75]}, {'hoverinfo': 'text', 'line': {'color': 'rgb(128, 128, 128)', 'width': 1}, 'mode': 'lines', 'name': 'lines', 'type': 'scatter', 'x': [12.0, 12.5, 13.0], 'y': [-1.75, -1.75, -1.75]}, {'hoverinfo': 'text', 'line': {'color': 'rgb(128, 128, 128)', 'width': 1}, 'mode': 'lines', 'name': 'lines', 'type': 'scatter', 'x': [13.0, 13.5, 14.0], 'y': [-1.75, -1.75, -1.75]}, {'hoverinfo': 'text', 'line': {'color': 'rgb(128, 128, 128)', 'width': 1}, 'mode': 'lines', 'name': 'lines', 'type': 'scatter', 'x': [14.0, 14.5, 15.0], 'y': [-1.75, -1.75, -1.75]}, {'hoverinfo': 'text', 'line': {'color': 'rgb(128, 128, 128)', 'width': 1}, 'mode': 'lines', 'name': 'lines', 'type': 'scatter', 'x': [15.0, 15.5, 16.0], 'y': [-1.75, -1.75, -1.75]}, {'hoverinfo': 'text', 'line': {'color': 'rgb(128, 128, 128)', 'width': 1}, 'mode': 'lines', 'name': 'lines', 'type': 'scatter', 'x': [16.0, 16.5, 17.0], 'y': [-1.75, -1.75, -1.75]}, {'hoverinfo': 'text', 'line': {'color': 'rgb(128, 128, 128)', 'width': 1}, 'mode': 'lines', 'name': 'lines', 'type': 'scatter', 'x': [1.0, 1.5, 2.0], 'y': [0.0, 0.375, 0.75]}, {'hoverinfo': 'text', 'line': {'color': 'rgb(128, 128, 128)', 'width': 1}, 'mode': 'lines', 'name': 'lines', 'type': 'scatter', 'x': [2.0, 2.5, 3.0], 'y': [0.75, 0.75, 0.75]}, {'hoverinfo': 'text', 'line': {'color': 'rgb(128, 128, 128)', 'width': 1}, 'mode': 'lines', 'name': 'lines', 'type': 'scatter', 'x': [3.0, 3.5, 4.0], 'y': [0.75, 0.75, 0.75]}, {'hoverinfo': 'text', 'line': {'color': 'rgb(128, 128, 128)', 'width': 1}, 'mode': 'lines', 'name': 'lines', 'type': 'scatter', 'x': [4.0, 4.5, 5.0], 'y': [0.75, 0.75, 0.75]}, {'hoverinfo': 'text', 'line': {'color': 'rgb(128, 128, 128)', 'width': 1}, 'mode': 'lines', 'name': 'lines', 'type': 'scatter', 'x': [2.0, 2.5, 3.0], 'y': [-0.75, -0.5, -0.25]}, {'hoverinfo': 'text', 'line': {'color': 'rgb(128, 128, 128)', 'width': 1}, 'mode': 'lines', 'name': 'lines', 'type': 'scatter', 'x': [3.0, 3.5, 4.0], 'y': [-0.25, -0.25, -0.25]}, {'hoverinfo': 'text', 'line': {'color': 'rgb(128, 128, 128)', 'width': 1}, 'mode': 'lines', 'name': 'lines', 'type': 'scatter', 'x': [4.0, 4.5, 5.0], 'y': [-0.25, -0.25, -0.25]}, {'hoverinfo': 'text', 'line': {'color': 'rgb(128, 128, 128)', 'width': 1}, 'mode': 'lines', 'name': 'lines', 'type': 'scatter', 'x': [5.0, 5.5, 6.0], 'y': [-1.25, -1.0, -0.75]}, {'hoverinfo': 'text', 'line': {'color': 'rgb(128, 128, 128)', 'width': 1}, 'mode': 'lines', 'name': 'lines', 'type': 'scatter', 'x': [6.0, 6.5, 7.0], 'y': [-0.75, -0.75, -0.75]}, {'hoverinfo': 'text', 'line': {'color': 'rgb(128, 128, 128)', 'width': 1}, 'mode': 'lines', 'name': 'lines', 'type': 'scatter', 'x': [7.0, 7.5, 8.0], 'y': [-0.75, -0.75, -0.75]}, {'hoverinfo': 'text', 'line': {'color': 'rgb(128, 128, 128)', 'width': 1}, 'mode': 'lines', 'name': 'lines', 'type': 'scatter', 'x': [8.0, 8.5, 9.0], 'y': [-0.75, -0.75, -0.75]}, {'hoverinfo': 'text', 'line': {'color': 'rgb(128, 128, 128)', 'width': 1}, 'mode': 'lines', 'name': 'lines', 'type': 'scatter', 'x': [9.0, 9.5, 10.0], 'y': [-0.75, -0.75, -0.75]}, {'hoverinfo': 'text', 'line': {'color': 'rgb(128, 128, 128)', 'width': 1}, 'mode': 'lines', 'name': 'lines', 'type': 'scatter', 'x': [10.0, 10.5, 11.0], 'y': [-0.75, -0.75, -0.75]}, {'hoverinfo': 'text', 'line': {'color': 'rgb(128, 128, 128)', 'width': 1}, 'mode': 'lines', 'name': 'lines', 'type': 'scatter', 'x': [11.0, 11.5, 12.0], 'y': [-0.75, -0.75, -0.75]}, {'hoverinfo': 'text', 'line': {'color': 'rgb(128, 128, 128)', 'width': 1}, 'mode': 'lines', 'name': 'lines', 'type': 'scatter', 'x': [12.0, 12.5, 13.0], 'y': [-0.75, -0.75, -0.75]}, {'hoverinfo': 'text', 'marker': {'color': 'rgb(128, 128, 128)', 'size': 1, 'symbol': 'circle'}, 'mode': 'markers', 'name': 'edge_center', 'text': array(['Index: 0
Name: None
Length: 1.0 km
R: 0.092 Ohm
X: 0.047 Ohm
', 'Index: 1
Name: None
Length: 1.0 km
R: 0.493 Ohm
X: 0.251 Ohm
', 'Index: 2
Name: None
Length: 1.0 km
R: 0.366 Ohm
X: 0.186 Ohm
', 'Index: 3
Name: None
Length: 1.0 km
R: 0.381 Ohm
X: 0.194 Ohm
', 'Index: 4
Name: None
Length: 1.0 km
R: 0.819 Ohm
X: 0.707 Ohm
', 'Index: 5
Name: None
Length: 1.0 km
R: 0.187 Ohm
X: 0.619 Ohm
', 'Index: 6
Name: None
Length: 1.0 km
R: 0.711 Ohm
X: 0.235 Ohm
', 'Index: 7
Name: None
Length: 1.0 km
R: 1.03 Ohm
X: 0.74 Ohm
', 'Index: 8
Name: None
Length: 1.0 km
R: 1.044 Ohm
X: 0.74 Ohm
', 'Index: 9
Name: None
Length: 1.0 km
R: 0.197 Ohm
X: 0.065 Ohm
', 'Index: 10
Name: None
Length: 1.0 km
R: 0.374 Ohm
X: 0.124 Ohm
', 'Index: 11
Name: None
Length: 1.0 km
R: 1.468 Ohm
X: 1.155 Ohm
', 'Index: 12
Name: None
Length: 1.0 km
R: 0.542 Ohm
X: 0.713 Ohm
', 'Index: 13
Name: None
Length: 1.0 km
R: 0.591 Ohm
X: 0.526 Ohm
', 'Index: 14
Name: None
Length: 1.0 km
R: 0.746 Ohm
X: 0.545 Ohm
', 'Index: 15
Name: None
Length: 1.0 km
R: 1.289 Ohm
X: 1.721 Ohm
', 'Index: 16
Name: None
Length: 1.0 km
R: 0.732 Ohm
X: 0.574 Ohm
', 'Index: 17
Name: None
Length: 1.0 km
R: 0.164 Ohm
X: 0.156 Ohm
', 'Index: 18
Name: None
Length: 1.0 km
R: 1.504 Ohm
X: 1.355 Ohm
', 'Index: 19
Name: None
Length: 1.0 km
R: 0.41 Ohm
X: 0.478 Ohm
', 'Index: 20
Name: None
Length: 1.0 km
R: 0.709 Ohm
X: 0.937 Ohm
', 'Index: 21
Name: None
Length: 1.0 km
R: 0.451 Ohm
X: 0.308 Ohm
', 'Index: 22
Name: None
Length: 1.0 km
R: 0.898 Ohm
X: 0.709 Ohm
', 'Index: 23
Name: None
Length: 1.0 km
R: 0.896 Ohm
X: 0.701 Ohm
', 'Index: 24
Name: None
Length: 1.0 km
R: 0.203 Ohm
X: 0.103 Ohm
', 'Index: 25
Name: None
Length: 1.0 km
R: 0.284 Ohm
X: 0.145 Ohm
', 'Index: 26
Name: None
Length: 1.0 km
R: 1.059 Ohm
X: 0.934 Ohm
', 'Index: 27
Name: None
Length: 1.0 km
R: 0.804 Ohm
X: 0.701 Ohm
', 'Index: 28
Name: None
Length: 1.0 km
R: 0.507 Ohm
X: 0.258 Ohm
', 'Index: 29
Name: None
Length: 1.0 km
R: 0.974 Ohm
X: 0.963 Ohm
', 'Index: 30
Name: None
Length: 1.0 km
R: 0.31 Ohm
X: 0.362 Ohm
', 'Index: 31
Name: None
Length: 1.0 km
R: 0.341 Ohm
X: 0.53 Ohm
'], dtype=object), 'type': 'scatter', 'x': [0.5], 'y': [0.0]}, {'hoverinfo': 'text', 'marker': {'color': 'rgb(255, 255, 0)', 'size': 20.0, 'symbol': 'square'}, 'mode': 'markers', 'name': 'external_grid', 'text': array(['Index: 0
Name: None
V_m: 1.0 p.u.
V_a: 0.0 °
'], dtype=object), 'type': 'scatter', 'x': [0.0], 'y': [0.0]}, {'hoverinfo': 'text', 'marker': {'color': 'rgb(0, 0, 255)', 'size': 10, 'symbol': 'circle'}, 'mode': 'markers', 'name': 'buses', 'text': array(['Index: 0
Name: 1
V_n: 12.66 kV
', 'Index: 1
Name: 2
V_n: 12.66 kV
Load: 0.100 MW
', 'Index: 2
Name: 3
V_n: 12.66 kV
Load: 0.090 MW
', 'Index: 3
Name: 4
V_n: 12.66 kV
Load: 0.120 MW
', 'Index: 4
Name: 5
V_n: 12.66 kV
Load: 0.060 MW
', 'Index: 5
Name: 6
V_n: 12.66 kV
Load: 0.060 MW
', 'Index: 6
Name: 7
V_n: 12.66 kV
Load: 0.200 MW
', 'Index: 7
Name: 8
V_n: 12.66 kV
Load: 0.200 MW
', 'Index: 8
Name: 9
V_n: 12.66 kV
Load: 0.060 MW
', 'Index: 9
Name: 10
V_n: 12.66 kV
Load: 0.060 MW
', 'Index: 10
Name: 11
V_n: 12.66 kV
Load: 0.045 MW
', 'Index: 11
Name: 12
V_n: 12.66 kV
Load: 0.060 MW
', 'Index: 12
Name: 13
V_n: 12.66 kV
Load: 0.060 MW
', 'Index: 13
Name: 14
V_n: 12.66 kV
Load: 0.120 MW
', 'Index: 14
Name: 15
V_n: 12.66 kV
Load: 0.060 MW
', 'Index: 15
Name: 16
V_n: 12.66 kV
Load: 0.060 MW
', 'Index: 16
Name: 17
V_n: 12.66 kV
Load: 0.060 MW
', 'Index: 17
Name: 18
V_n: 12.66 kV
Load: 0.090 MW
', 'Index: 18
Name: 19
V_n: 12.66 kV
Load: 0.090 MW
', 'Index: 19
Name: 20
V_n: 12.66 kV
Load: 0.090 MW
', 'Index: 20
Name: 21
V_n: 12.66 kV
Load: 0.090 MW
', 'Index: 21
Name: 22
V_n: 12.66 kV
Load: 0.090 MW
', 'Index: 22
Name: 23
V_n: 12.66 kV
Load: 0.090 MW
', 'Index: 23
Name: 24
V_n: 12.66 kV
Load: 0.420 MW
', 'Index: 24
Name: 25
V_n: 12.66 kV
Load: 0.420 MW
', 'Index: 25
Name: 26
V_n: 12.66 kV
Load: 0.060 MW
', 'Index: 26
Name: 27
V_n: 12.66 kV
Load: 0.060 MW
', 'Index: 27
Name: 28
V_n: 12.66 kV
Load: 0.060 MW
', 'Index: 28
Name: 29
V_n: 12.66 kV
Load: 0.120 MW
', 'Index: 29
Name: 30
V_n: 12.66 kV
Load: 0.200 MW
', 'Index: 30
Name: 31
V_n: 12.66 kV
Load: 0.150 MW
', 'Index: 31
Name: 32
V_n: 12.66 kV
Load: 0.210 MW
', 'Index: 32
Name: 33
V_n: 12.66 kV
Load: 0.060 MW
'], dtype=object), 'type': 'scatter', 'x': [0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 2.0, 3.0, 4.0, 5.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0], 'y': [0.0, 0.0, -0.75, -1.25, -1.25, -1.25, -1.75, -1.75, -1.75, -1.75, -1.75, -1.75, -1.75, -1.75, -1.75, -1.75, -1.75, -1.75, 0.75, 0.75, 0.75, 0.75, -0.25, -0.25, -0.25, -0.75, -0.75, -0.75, -0.75, -0.75, -0.75, -0.75, -0.75]}], 'layout': {'autosize': True, 'height': 102.94117647058823, 'hovermode': 'closest', 'margin': {'b': 5, 'l': 5, 'r': 5, 't': 5}, 'showlegend': True, 'template': '...', 'title': {'font': {'size': 16}}, 'width': 700.0, 'xaxis': {'showgrid': False, 'showticklabels': False, 'zeroline': False}, 'yaxis': {'showgrid': False, 'showticklabels': False, 'zeroline': False}} })`

rbolgaryn commented 3 years ago

Hi @hitchenzhe ,

can you proviede a small example?

hitchenzhe commented 3 years ago

Hi @hitchenzhe ,

can you proviede a small example?

I just can not use plotly, I don know why, but matplot works

rbolgaryn commented 3 years ago

Does this code work for you?

import pandapower.networks as nw
from pandapower.plotting.plotly.simple_plotly import simple_plotly
from plotly.offline import plot
net = nw.mv_oberrhein()
fig = simple_plotly(net)
plot(fig)
seilsepour commented 6 months ago

Hi there I have problem with simple_plotly too. I can not run the above code. It resurns the following error:

WARNING:pandapower.auxiliary:numba cannot be imported and numba functions are disabled.
Probably the execution is slow.
Please install numba to gain a massive speedup.
(or if you prefer slow execution, set the flag numba=False to avoid this warning!)

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
[<ipython-input-66-e049a360e961>](https://localhost:8080/#) in <cell line: 5>()
      3 from plotly.offline import plot
      4 net = nw.mv_oberrhein()
----> 5 fig = simple_plotly(net)
      6 plot(fig)

6 frames
[/usr/local/lib/python3.10/dist-packages/pandas/core/generic.py](https://localhost:8080/#) in blk_func(values)
   1556                 # [ExtensionArray, ndarray[Any, Any]]"; expected
   1557                 # "_SupportsPos[ndarray[Any, dtype[Any]]]"
-> 1558                 return operator.pos(values)  # type: ignore[arg-type]
   1559 
   1560         new_data = self._mgr.apply(blk_func)

TypeError: bad operand type for unary +: 'str'
seilsepour commented 6 months ago

Hi @rbolgaryn, can you help me? this is my code:

from pandapower.plotting.plotly import simple_plotly
simple_plotly(net) 

I got this error:

[/usr/local/lib/python3.10/dist-packages/pandas/core/generic.py](https://localhost:8080/#) in blk_func(values)
   1556                 # [ExtensionArray, ndarray[Any, Any]]"; expected
   1557                 # "_SupportsPos[ndarray[Any, dtype[Any]]]"
-> 1558                 return operator.pos(values)  # type: ignore[arg-type]
   1559 
   1560         new_data = self._mgr.apply(blk_func)

TypeError: bad operand type for unary +: 'str'

Even I can not use this function in the simplest way. Thanks in advance