Skip to main content

Interactive web visualizer for pandapower networks

Project description

pandapower-viz

Interactive web visualizer for pandapower networks. Render power system diagrams and geographic maps — in the browser, in Jupyter notebooks, or embedded in React apps.

pandapower-viz screenshot

Features

  • Network Diagram — Interactive graph visualization with vis-network. Zoom, pan, drag, and click elements to inspect properties.
  • Geographic Map — Plot buses and lines on OpenStreetMap when coordinates are available.
  • Color Modes — Color by element type, voltage level, or loading percentage.
  • Compact Mode — Automatically simplifies large networks (>500 buses) for performance.
  • Dark & Light Themes — Full theme support via CSS custom properties.
  • Dual Distribution — Use from Python (pip install) or React (npm install).
  • Jupyter Support — Renders inline in notebook cells via anywidget.

Python Usage

pip install pandapower-viz
import pandapower as pp
import pandapower_viz as pv

net = pp.networks.case_ieee30()
pp.runpp(net)
pv.show(net)  # opens browser at localhost:8050

Jupyter Notebook

pv.show(net) auto-detects Jupyter and renders the diagram inline in the cell:

# In a Jupyter notebook cell:
import pandapower as pp
import pandapower_viz as pv

net = pp.networks.case_ieee30()
pp.runpp(net)
pv.show(net)  # renders inline — no browser tab opened

You can also use the widget directly for more control:

from pandapower_viz import NetworkWidget

w = NetworkWidget.from_net(net)
display(w)

# Update the network later:
pp.runpp(net)
w.update_network(net)

React Usage

npm install pandapower-viz
import { NetworkDiagram, parsePandaPowerJson } from 'pandapower-viz';
import 'pandapower-viz/dist/style.css';

function App({ data }) {
  const network = parsePandaPowerJson(data);
  return (
    <NetworkDiagram
      network={network}
      theme="dark"
      onElementSelect={(el) => console.log(el)}
    />
  );
}

Components

Component Description
NetworkDiagram Interactive network graph (vis-network). Supports color modes, compact mode, physics simulation.
NetworkMap Geographic map (Leaflet/OpenStreetMap). Shows buses as markers, lines as polylines.

Utilities

Function Description
parsePandaPowerJson(data) Parse pandapower JSON (from pp.to_json()) into a typed network object.
convertToVisNetwork(network) Convert network to vis-network nodes and edges (detailed mode).
convertToVisNetworkCompact(network) Convert to simplified nodes/edges for large networks.
getNetworkStatistics(network) Get element counts (buses, lines, trafos, etc.).
extractGeodata(network) Extract geographic coordinates from bus data.
getElementInfo(element, network) Get detailed properties for a selected element.
calculateTreeLayout(nodes, edges) Compute hierarchical tree positions for network nodes.

Theming

pandapower-viz uses CSS custom properties prefixed with --ppviz-. Override them to match your app's theme:

:root {
  --ppviz-bg-primary: var(--your-bg);
  --ppviz-text-primary: var(--your-text);
  --ppviz-brand-accent: var(--your-accent);
}

Or use the data-ppviz-theme attribute for built-in dark/light themes:

<div data-ppviz-theme="light">
  <!-- pandapower-viz components here -->
</div>

Supported Elements

Buses, lines, transformers (2-winding), loads, generators, static generators (solar PV, wind), battery storage, switches, external grids.

Requirements

  • Python: 3.9+ with pandapower
  • React: 18+
  • Peer dependencies: react, react-dom

Development

git clone https://github.com/matheusduartedm/pandapower-viz
cd pandapower-viz/frontend
npm install
npm run dev        # start dev server
npm test           # run tests
npm run build-lib  # build npm library

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pandapower_viz-1.1.1.tar.gz (800.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pandapower_viz-1.1.1-py3-none-any.whl (512.1 kB view details)

Uploaded Python 3

File details

Details for the file pandapower_viz-1.1.1.tar.gz.

File metadata

  • Download URL: pandapower_viz-1.1.1.tar.gz
  • Upload date:
  • Size: 800.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for pandapower_viz-1.1.1.tar.gz
Algorithm Hash digest
SHA256 92e95cf198065878c90c89ac14ea050a8f4441e8030fff40c2aabcf43f1f15b7
MD5 e59a2e2df4ff530829c539d060230f1f
BLAKE2b-256 00901b6be3dddce64b40e599b42df6fc067c94c84db4ddab6d49447ef91097d6

See more details on using hashes here.

File details

Details for the file pandapower_viz-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: pandapower_viz-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 512.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for pandapower_viz-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ffb35a13794d2edf8727b4655e68a1dacac680abd1ee1e5c5e0d2aadb9ca0668
MD5 20bfd880b7fae289e4f767b104e93b66
BLAKE2b-256 be66a7f798c4a8aa126bb46ddca1ce52fdeb7dc4d7e1356857a0b3e9d9510f14

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page