Parameter Arguments

The following parameters can be used to as keyword arguments to modify a plot

Plot parameters

These parameters modify the entire plot.

KeywordDescriptionDefault
widthwidth of the plot in pixels500
heightheight of the plot in pixels500
layout_algorithmalgorithm for generating network layout (see Layouts)kamada_kawai
fixeduse fixed coordinates from network modelfalse
parallel_edge_offsetoffset distance between parallel edges0.05
node_componentsstring or symbol array of node components to plotdefault_node_types
edge_componentsstring or symbol array of edge components to plotdefault_edge_types
connected_componentsstring or symbol array of connected components to plotdefault_connected_types

The current set of default component types includes:

default_node_types
1-element Vector{Symbol}:
 :bus
default_edge_types
5-element Vector{Symbol}:
 :branch
 :dcline
 :switch
 :transformer
 :line
default_connected_types
7-element Vector{Symbol}:
 :gen
 :load
 :storage
 :generator
 :voltage_source
 :solar
 :shunt

Component Parameters

These parameters modify a specific component.

Color

The :color argument can accept several inputs. A single color can be specified using a color name as a symbol or a string. CSS color names are supported. In addition, hex color values in a string are supported.

powerplot(case; branch=(:color=:yellow))
powerplot(case; branch=(:color="yellow"))
powerplot(case; branch=(:color="#FFA71A"))

A color range can be created by using several colors in an array. The range is used when component data is specified.

powerplot(case; branch=(:color=>[:red, "yellow", "#0000FF"]))

A color scheme from ColorSchemes.jl can be used, but the ColorScheme must be converted to an array of colors that can be interpreted by VegaLite.

using ColorSchemes
powerplot(case; branch=(:color=>colorscheme2array(ColorSchemes.colorschemes[:tableau_10])))

Default colors are determined by the order the components are plotted, shown in the legend. The default color profiles are:

Flow

Power flow can be shown on edges of the network. For each edge component, the following parameters are available:

KeywordDescriptionDefault
show_flowwhether flow arrows representing 'pt' are displayed on edgesfalse
show_flow_legendwhether the legend for the flow arrows is shownfalse
powerplot(case; branch=(:show_flow=>true, :show_flow_legend=>true))

Size

The :size argument sets the size of a component. The size does not vary with data in the base plot.

ComponentDescriptionDefault
edgedefault size of all edges except connector5
connectordefault size of connector3
nodeset the size of all nodes500
powerplot(case; branch=(:size=>10), gen=(:size=>250))

The size of the flow arrows is a keyword that is a subset of the edge it models. However, the only first plotted component in the legend will use the flow_arrow_size_range keyword. All subsequent components will use the same range as the first.

powerplot(case;
    branch=(:show_flow=>true, :show_flow_legend=>true,
     :flow_arrow_size_range=>[100,500]),
    switch=(:show_flow=>true, :show_flow_legend=>true,
     :flow_arrow_size_range=>[500,3000])
)

Data

The :data argument selects the data from the component dictionary to use in the visualization. The data argument can be a string or a symbol. The data value modifies the color of a component based on the color range.

powerplot(case; gen(:data=:pmax))
powerplot(case; gen(:data=:pmin))

Datatype

The datatypes in VegaLite can be :nominal, :ordinal, or :quantintative. :nominal and :ordinal are both discrete values, and :quantitative is continuous. In the context of the simple powerplot, there is no distinction between :nominal and :ordinal. The default data type is nominal.

powerplot(case; gen(:data=:pg, :data_type=:quantitative)) # the pg is continous, so use a continous scale
powerplot(case; gen(:data=:index, :data_type=:nominal)) # the index is a discrete value, so use a discrete scale

Other Parameters

The length of the dashes on the connector lines can be controlled with the :dash keyword. The value is a two element array, with the first term representing the length of the gap and the second term representing the length of the dash.

KeywordDescriptionDefault
:dashset dash size for connectors[4,4]
powerplot(case, connector = (:dash=>[2,2]))
powerplot(case, connector = (:dash=>[2,8]))