PowerGraphics API

PowerGraphics.load_paletteMethod
load_palette()
load_palette(file)

Loads color palette yaml from environment, the DEFAULT_PALETTE_FILE, or a given file. See DEFAULT_PALETTE_FILE for an example.

Arguments

  • file : path to YAML color palette
source
PowerGraphics.plot_dataframe!Method
plot_dataframe!(plot, df)
plot_dataframe!(plot, df, time_range)

Plots data from DataFrame where each row represents a time period and each column represents a trace

Arguments

  • plot: existing plot handle
  • df::DataFrames.DataFrame: DataFrame where each row represents a time period and each column represents a trace.

If only the dataframe is provided, it must have a column of DateTime values.

  • time_range:::Union{DataFrames.DataFrame, Array, StepRange}: The time periods of the data

Accepted Key Words

  • curtailment::Bool: plot the curtailment with the variable
  • set_display::Bool = true: set to false to prevent the plots from displaying
  • save::String = "file_path": set a file path to save the plots
  • format::String = "png": set a different format for saving a PlotlyJS plot
  • seriescolor::Array: Set different colors for the plots
  • title::String = "Title": Set a title for the plots
  • stack::Bool = true: stack plot traces
  • bar::Bool : create bar plot
  • nofill::Bool : force empty area fill
  • stair::Bool: Make a stair plot instead of a stack plot
source
PowerGraphics.plot_dataframeMethod
plot_dataframe(df)
plot_dataframe(df, time_range)

Plots data from DataFrame where each row represents a time period and each column represents a trace

Arguments

  • df::DataFrames.DataFrame: DataFrame where each row represents a time period and each column represents a trace.

If only the dataframe is provided, it must have a column of DateTime values.

  • time_range:::Union{DataFrames.DataFrame, Array, StepRange}: The time periods of the data

Example

var_name = :P__ThermalStandard
df = PowerSimulations.read_variables_with_keys(results, names = [var_name])[var_name]
time_range = PowerSimulations.get_realized_timestamps(results)
plot = plot_dataframe(df, time_range)

Accepted Key Words

  • curtailment::Bool: plot the curtailment with the variable
  • set_display::Bool = true: set to false to prevent the plots from displaying
  • save::String = "file_path": set a file path to save the plots
  • format::String = "png": set a different format for saving a PlotlyJS plot
  • seriescolor::Array: Set different colors for the plots
  • title::String = "Title": Set a title for the plots
  • stack::Bool = true: stack plot traces
  • bar::Bool : create bar plot
  • nofill::Bool : force empty area fill
  • stair::Bool: Make a stair plot instead of a stack plot
source
PowerGraphics.plot_demand!Method
plot_demand!(plot, results)
plot_demand!(plot, system)

This function makes a plot of the demand in the system.

Arguments

  • plot : existing plot handle
  • result::Union{IS.Results, PSY.System} : simulation results or PowerSystems.System

Accepted Key Words

  • linestyle::Symbol = :dash : set line style
  • title::String: Set a title for the plots
  • horizon::Int64: To plot a shorter window of time than the full results
  • initial_time::DateTime: To start the plot at a different time other than the results initial time
  • aggregate::String = "System", "PowerLoad", or "Bus": aggregate the demand other than by generator
  • set_display::Bool = true: set to false to prevent the plots from displaying
  • save::String = "file_path": set a file path to save the plots
  • format::String = "png": set a different format for saving a PlotlyJS plot
  • seriescolor::Array: Set different colors for the plots
  • title::String = "Title": Set a title for the plots
  • stack::Bool = true: stack plot traces
  • bar::Bool : create bar plot
  • nofill::Bool : force empty area fill
  • stair::Bool: Make a stair plot instead of a stack plot
  • filter_func::Function = PowerSystems.get_available : filter components included in plot
  • palette : color palette from load_palette
source
PowerGraphics.plot_fuel!Method
plot_fuel!(plot, results)

This function makes a stack plot of the results by fuel type and assigns each fuel type a specific color.

Arguments

  • plot : existing plot handle (optional)
  • res::PowerSimulations.Results : results to be plotted

Accepted Key Words

  • generator_mapping_file = "file_path" : file path to yaml defining generator category by fuel and primemover
  • variables::Union{Nothing, Vector{Symbol}} = nothing : specific variables to plot
  • slacks::Bool = true : display slack variables
  • load::Bool = true : display load line
  • curtailment::Bool = true: To plot the curtailment in the stack plot
  • set_display::Bool = true: set to false to prevent the plots from displaying
  • save::String = "file_path": set a file path to save the plots
  • format::String = "png": set a different format for saving a PlotlyJS plot
  • seriescolor::Array: Set different colors for the plots
  • title::String = "Title": Set a title for the plots
  • stack::Bool = true: stack plot traces
  • bar::Bool : create bar plot
  • nofill::Bool : force empty area fill
  • stair::Bool: Make a stair plot instead of a stack plot
  • filter_func::Function = PowerSystems.get_available : filter components included in plot
  • palette : Color palette as from load_palette.
source
PowerGraphics.plot_fuelMethod
plot_fuel(results)

This function makes a stack plot of the results by fuel type and assigns each fuel type a specific color.

Arguments

  • res::PowerSimulations.Results : results to be plotted

Example

res = solve_op_problem!(OpProblem)
plot = plot_fuel(res)

Accepted Key Words

  • generator_mapping_file = "file_path" : file path to yaml defining generator category by fuel and primemover
  • variables::Union{Nothing, Vector{Symbol}} = nothing : specific variables to plot
  • slacks::Bool = true : display slack variables
  • load::Bool = true : display load line
  • curtailment::Bool = true: To plot the curtailment in the stack plot
  • set_display::Bool = true: set to false to prevent the plots from displaying
  • save::String = "file_path": set a file path to save the plots
  • format::String = "png": set a different format for saving a PlotlyJS plot
  • seriescolor::Array: Set different colors for the plots
  • title::String = "Title": Set a title for the plots
  • stack::Bool = true: stack plot traces
  • bar::Bool : create bar plot
  • nofill::Bool : force empty area fill
  • stair::Bool: Make a stair plot instead of a stack plot
  • filter_func::Function = PowerSystems.get_available : filter components included in plot
source
PowerGraphics.plot_powerdata!Method
plot_powerdata!(plot, powerdata)

This function makes a plot of a PGdata object

Arguments

  • plot : existing plot handle (optional)
  • powerdata::PowerData: The dataframe to be plotted

Accepted Key Words

  • combine_categories::Bool = false : plot category values or each value in a category
  • curtailment::Bool: plot the curtailment with the variable
  • set_display::Bool = true: set to false to prevent the plots from displaying
  • save::String = "file_path": set a file path to save the plots
  • format::String = "png": set a different format for saving a PlotlyJS plot
  • seriescolor::Array: Set different colors for the plots
  • title::String = "Title": Set a title for the plots
  • stack::Bool = true: stack plot traces
  • bar::Bool : create bar plot
  • nofill::Bool : force empty area fill
  • stair::Bool: Make a stair plot instead of a stack plot
source
PowerGraphics.plot_powerdataMethod
plot_powerdata(powerdata)

This function makes a plot of a PGdata object

Arguments

  • powerdata::PowerData: The dataframe to be plotted

Accepted Key Words

  • combine_categories::Bool = false : plot category values or each value in a category
  • curtailment::Bool: plot the curtailment with the variable
  • set_display::Bool = true: set to false to prevent the plots from displaying
  • save::String = "file_path": set a file path to save the plots
  • format::String = "png": set a different format for saving a PlotlyJS plot
  • seriescolor::Array: Set different colors for the plots
  • title::String = "Title": Set a title for the plots
  • stack::Bool = true: stack plot traces
  • bar::Bool : create bar plot
  • nofill::Bool : force empty area fill
  • stair::Bool: Make a stair plot instead of a stack plot
source
PowerGraphics.plot_results!Method
plot_results!(plot, results)

This function makes a plot of a results dictionary

Arguments

  • plot : existing plot handle (optional)
  • results::Dict{String, DataFrame}: The results to be plotted

Accepted Key Words

  • combine_categories::Bool = false : plot category values or each value in a category
  • curtailment::Bool: plot the curtailment with the variable
  • set_display::Bool = true: set to false to prevent the plots from displaying
  • save::String = "file_path": set a file path to save the plots
  • format::String = "png": set a different format for saving a PlotlyJS plot
  • seriescolor::Array: Set different colors for the plots
  • title::String = "Title": Set a title for the plots
  • stack::Bool = true: stack plot traces
  • bar::Bool : create bar plot
  • nofill::Bool : force empty area fill
  • stair::Bool: Make a stair plot instead of a stack plot
source
PowerGraphics.plot_resultsMethod
plot_results(results)

This function makes a plot of a results dictionary object

Arguments

  • results::Dict{String, DataFrame: The results to be plotted

Accepted Key Words

  • combine_categories::Bool = false : plot category values or each value in a category
  • curtailment::Bool: plot the curtailment with the variable
  • set_display::Bool = true: set to false to prevent the plots from displaying
  • save::String = "file_path": set a file path to save the plots
  • format::String = "png": set a different format for saving a PlotlyJS plot
  • seriescolor::Array: Set different colors for the plots
  • title::String = "Title": Set a title for the plots
  • stack::Bool = true: stack plot traces
  • bar::Bool : create bar plot
  • nofill::Bool : force empty area fill
  • stair::Bool: Make a stair plot instead of a stack plot
source
PowerGraphics.reportMethod
report(res::IS.Results, out_path::String, design_template::String)

This function uses Weave.jl to either generate a LaTeX or HTML file based on the reportdesign.jmd (julia markdown) file that it reads. Outpath in the weave function dictates where the created file gets exported. An example template is available here

Arguments

  • results::IS.Results: The results to be plotted
  • out_path::String: folder path to the location the report should be generated
  • design_template::String = "file_path": directs the function to the julia markdown report design, the default

Example

results = solve_op_problem!(OpModel)
out_path = "/Users/downloads"
report(results, out_path, template)

Accepted Key Words

  • doctype::String = "md2html": create an HTML, default is PDF via latex
  • backend::Plots.backend() = plotlyjs(): sets the plots backend, default is gr()
source
PowerGraphics.save_plotMethod
save_plot(plot, filename)

Saves plot to specified filename

Arguments

  • plot: plot object
  • filename::String : save to filename

Example

res = solve_op_problem!(OpProblem)
plot = plot_fuel(res)
save_plot(plot, "my_plot.png")

Accepted Key Words (currently only implemented for PlotlyJS backend)

  • width::Union{Nothing,Int}=nothing
  • height::Union{Nothing,Int}=nothing
  • scale::Union{Nothing,Real}=nothing
source