PowerPlots.jl Documentation

PowerPlots.jl is a package for visualizing power grids, using the data spec from PowerModels.jl and PowerModelsDistribution.jl. This package uses VegaLite.jl as the plotting backend.

Installation

pkg> add PowerPlots

Basic Overview

Open a power systems case using PowerModels.jl and run the command powerplot on the data.

using PowerModels
using PowerPlots
case = parse_file("case14.m")
powerplot(case)
Example block output

The function creates a layout for the graph and plots the system. The plot is interactive, and hovering over a component allows you to see the component data. By default, plots are displayed in a browser window but using ElectronDisplay.jl will display plots in its own window. Using the VSCode extension will display plots in the plot pane.

NOTE: Interactive VegaLite plots are not currently supported by some notebooks, like Jupyter Notebook. If you use Jupyter Notebook, you can using ElectronDisplay.jl to display interactive plots.

Creating Visualizations

The primary use for PowerPlots is to visualize data in the PowerModels dictionary. Each component can specify a data value to visualize, such as the pmax for the generators or the rate_a of the branches.

powerplot(case;
    gen_data=:pmax,
    branch_data=:rate_a,
    branch_color=[:white,:blue],
    branch_data_type=:quantitative
)
Example block output

Altering Data

New data can be added to the dictionary and visualized as well.

case["gen"]["1"]["gen_type"] = "PV"
case["gen"]["2"]["gen_type"] = "Coal"
case["gen"]["3"]["gen_type"] = "Hydro"
case["gen"]["4"]["gen_type"] = "CCGT"
case["gen"]["5"]["gen_type"] = "Wind"

using ColorSchemes
powerplot(case;
    gen_data=:gen_type,
    gen_color = colorscheme2array(ColorSchemes.colorschemes[:seaborn_deep]),
    bus_color=:black
)
Example block output