Closed sylvlecl closed 2 years ago
https://github.com/powsybl/powsybl-single-line-diagram/pull/270 has to be solved before otherwise (I tested!), SVG does not fit correctly in the notebook.
Indeed I've tested too, you need to change the viewbox of the svg element to make it work :( Thanks for the link, good to know that the issue was already logged :)
Also an interesting feature, according to https://graphviz.readthedocs.io/en/stable/manual.html#jupyter-notebooks if we return an object that implement _repr_svg_()
the notebook automatically display the SVG. So we should return a SvgSingleLineDiagram
object in Python from n.get_single_line_diagram('vl1')
implementing this method.
So we could just write:
sld = n.get_single_line_diagram('vl1')
sld
Then as soon as you want to be able to zoom/drag, some javascript needs to be involved. It looks feasible but needs to write a notebook extension ...
Maybe we could try to write a small extension to do this using svg.panzoom.js
like in gridsuite, to give this approach a try.
Note that this would not be powsybl specific at all!
The first part (static image) is ok since #229
Closing the issue since the main feature has been implemented.
We'll create more issues in the future for more dynamic integrations, if there is some demand.
Feature
Single line diagrams can only be exported as SVG files to disk in the python API.
It would be great to be able to visualize the single line diagram, in a jupyter notebook environment, without going through a file on disk.
In order to achieve this, we can :
For the second part, it would be great to be able to zoom in/out, and to drag around the image. We need to investigate if for example
plotly
oripywidgets
allow to do this with an SVG. jupyter-dash might actually be the most powerful option here, although it brings in a lot of dependencies.Network inspection in an interactive environment.