{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Plotting traces (collections)\n", "This Tutorial explains how to customize network plots in pandapower using plotly. Each pandapower network element can be translated into a plotly trace with all corresponding properties..." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import pandapower as pp\n", "import pandapower.networks as nw\n", "import pandapower.plotting.plotly as pplotly\n", "from pandas import Series\n", "import numpy as np" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We created a network along with geodata in the buses." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "1" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "net = pp.create_empty_network()\n", "x=np.array([0,-2,2,-3,-2,2])\n", "y=np.array([4,3,3,-3,-2,-2])\n", "for i in range(6):\n", " if i < 3:\n", " v = 110\n", " elif i == 3:\n", " v = 20 \n", " else:\n", " v=10\n", " pp.create_bus(net, vn_kv=v,geodata=(x[i], y[i]))\n", "\n", "pp.create_line(net, 0, 1, 5, \"149-AL1/24-ST1A 110.0\",geodata=None,name='l1')\n", "pp.create_line(net, 0, 2, 5, \"149-AL1/24-ST1A 110.0\",geodata=None,name='l2')\n", "pp.create_transformer3w(net, 1, 3, 4, \"63/25/38 MVA 110/20/10 kV\", name='tr1')\n", "\n", "\n", "pp.create_transformer(net, 2, 5, \"0.25 MVA 20/0.4 kV\", name='tr2')\n", "\n", "\n", "pp.create_ext_grid(net, 0)\n", "pp.create_load(net, 4, p_mw=20., q_mvar=10., name='load1')\n", "pp.create_load(net, 5, p_mw=20., q_mvar=10., name='load1')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "If you want to have full control over the layout of your plot, you can individually create and plot collections with the pandapower plotting module." ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "scrolled": true }, "outputs": [ { "data": { "text/html": [ "