Public API Reference
PowerGraphics.load_palette — Methodload_palette()
load_palette(file)Loads color palette yaml from environment, the DEFAULT_PALETTE_FILE, or a given file. See color-palette.yaml for an example.
Arguments
file: path to YAML color palette
PowerGraphics.plot_dataframe! — Methodplot_dataframe!(plot, df)
plot_dataframe!(plot, df, time_range)Plots data from a DataFrames.DataFrame where each row represents a time period and each column represents a trace
Arguments
plot: existing plot handle, such as the result ofplot()df::DataFrames.DataFrame:DataFramewhere 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 variableset_display::Bool = true: set to false to prevent the plots from displayingsave::String = "file_path": set a file path to save the plotsformat::String = "png": set a different format for saving a PlotlyJS plot. Options include "png", "pdf" and "eps"seriescolor::Array: Set different colors for the plotstitle::String = "Title": Set a title for the plotsstack::Bool = true: stack plot tracesbar::Bool: create bar plotnofill::Bool: force empty area fillstair::Bool: Make a stair plot instead of a stack plot
PowerGraphics.plot_dataframe — Methodplot_dataframe(df)
plot_dataframe(df, time_range)Plots data from a DataFrames.DataFrame where each row represents a time period and each column represents a trace
Arguments
df::DataFrames.DataFrame:DataFramewhere 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 variableset_display::Bool = true: set to false to prevent the plots from displayingsave::String = "file_path": set a file path to save the plotsformat::String = "png": set a different format for saving a PlotlyJS plot. Options include "png", "pdf" and "eps"seriescolor::Array: Set different colors for the plotstitle::String = "Title": Set a title for the plotsstack::Bool = true: stack plot tracesbar::Bool: create bar plotnofill::Bool: force empty area fillstair::Bool: Make a stair plot instead of a stack plot
PowerGraphics.plot_demand! — Methodplot_demand!(plot, result)
plot_demand!(plot, system)Plots the demand in the system.
Arguments
plot: existing plot handle, such as the result ofplot()res::Union{InfrastructureSystems.Results,PowerSystems.System}: AResultsobject (e.g.,PowerSimulations.SimulationProblemResults) orPowerSystems.Systemto plot the demand from
Accepted Key Words
linestyle::Symbol = :dash: set line styletitle::String: Set a title for the plotshorizon::Int64: To plot a shorter window of time than the full resultsinitial_time::DateTime: To start the plot at a different time other than the results initial timeaggregate::String = "System", "PowerLoad", or "Bus": aggregate the demand byPowerSystems.System,PowerSystems.PowerLoad, orPowerSystems.Bus, rather than by generatorset_display::Bool = true: set to false to prevent the plots from displayingsave::String = "file_path": set a file path to save the plotsformat::String = "png": set a different format for saving a PlotlyJS plot. Options include "png", "pdf" and "eps"seriescolor::Array: Set different colors for the plotstitle::String = "Title": Set a title for the plotsstack::Bool = true: stack plot tracesbar::Bool: create bar plotnofill::Bool: force empty area fillstair::Bool: Make a stair plot instead of a stack plotfilter_func::Function =PowerSystems.get_available: filter components included in plotpalette: color palette fromload_palette
PowerGraphics.plot_fuel! — Methodplot_fuel!(plot, results)Plots a stack plot of the results by fuel type and assigns each fuel type a specific color.
Arguments
plot: existing plot handle, such as the result ofplot()(optional)res::InfrastructureSystems.Results: AResultsobject (e.g.,PowerSimulations.SimulationProblemResults) to be plotted
Accepted Key Words
generator_mapping_file= "file_path" : file path to yaml defining generator category by fuel and primemovervariables::Union{Nothing, Vector{Symbol}}= nothing : specific variables to plotslacks::Bool = true: display slack variablesload::Bool = true: display load linecurtailment::Bool = true: To plot the curtailment in the stack plotset_display::Bool = true: set to false to prevent the plots from displayingsave::String = "file_path": set a file path to save the plotsformat::String = "png": set a different format for saving a PlotlyJS plot. Options include "png", "pdf" and "eps"seriescolor::Array: Set different colors for the plotstitle::String = "Title": Set a title for the plotsstack::Bool = true: stack plot tracesbar::Bool: create bar plotnofill::Bool: force empty area fillstair::Bool: Make a stair plot instead of a stack plotfilter_func::Function =PowerSystems.get_available: filter components included in plotpalette: Color palette as fromload_palette.
PowerGraphics.plot_fuel — Methodplot_fuel(results)Plots a stack plot of the results by fuel type and assigns each fuel type a specific color.
Arguments
res::InfrastructureSystems.Results: AResultsobject (e.g.,PowerSimulations.SimulationProblemResults) to be plottedExample
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 primemovervariables::Union{Nothing, Vector{Symbol}}= nothing : specific variables to plotslacks::Bool = true: display slack variablesload::Bool = true: display load linecurtailment::Bool = true: To plot the curtailment in the stack plotset_display::Bool = true: set to false to prevent the plots from displayingsave::String = "file_path": set a file path to save the plotsformat::String = "png": set a different format for saving a PlotlyJS plot. Options include "png", "pdf" and "eps"seriescolor::Array: Set different colors for the plotstitle::String = "Title": Set a title for the plotsstack::Bool = true: stack plot tracesbar::Bool: create bar plotnofill::Bool: force empty area fillstair::Bool: Make a stair plot instead of a stack plotfilter_func::Function =PowerSystems.get_available: filter components included in plot
PowerGraphics.plot_powerdata! — Methodplot_powerdata!(plot, powerdata)Makes a plot from a PowerAnalytics.PowerData object, such as the result of PowerAnalytics.get_generation_data
Arguments
plot: existing plot handle, such as the result ofplot()(optional)powerdata::PowerAnalytics.PowerData: ThePowerDataobject to be plotted
Accepted Key Words
combine_categories::Bool = false: plot category values or each value in a categorycurtailment::Bool: plot the curtailment with the variableset_display::Bool = true: set to false to prevent the plots from displayingsave::String = "file_path": set a file path to save the plotsformat::String = "png": set a different format for saving a PlotlyJS plot. Options include "png", "pdf" and "eps"seriescolor::Array: Set different colors for the plotstitle::String = "Title": Set a title for the plotsstack::Bool = true: stack plot tracesbar::Bool: create bar plotnofill::Bool: force empty area fillstair::Bool: Make a stair plot instead of a stack plot
PowerGraphics.plot_powerdata — Methodplot_powerdata(powerdata)Makes a plot from a PowerAnalytics.PowerData object, such as the result of PowerAnalytics.get_generation_data
Arguments
powerdata::PowerAnalytics.PowerData: ThePowerDataobject to be plotted
Accepted Key Words
combine_categories::Bool = false: plot category values or each value in a categorycurtailment::Bool: plot the curtailment with the variableset_display::Bool = true: set to false to prevent the plots from displayingsave::String = "file_path": set a file path to save the plotsformat::String = "png": set a different format for saving a PlotlyJS plot. Options include "png", "pdf" and "eps"seriescolor::Array: Set different colors for the plotstitle::String = "Title": Set a title for the plotsstack::Bool = true: stack plot tracesbar::Bool: create bar plotnofill::Bool: force empty area fillstair::Bool: Make a stair plot instead of a stack plot
PowerGraphics.plot_results! — Methodplot_results!(plot, results)Makes a plot from a results dictionary
Arguments
plot: existing plot handle, such as the result ofplot()(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 categorycurtailment::Bool: plot the curtailment with the variableset_display::Bool = true: set to false to prevent the plots from displayingsave::String = "file_path": set a file path to save the plotsformat::String = "png": set a different format for saving a PlotlyJS plot. Options include "png", "pdf" and "eps"seriescolor::Array: Set different colors for the plotstitle::String = "Title": Set a title for the plotsstack::Bool = true: stack plot tracesbar::Bool: create bar plotnofill::Bool: force empty area fillstair::Bool: Make a stair plot instead of a stack plot
PowerGraphics.plot_results — Methodplot_results(results)Makes a plot from 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 categorycurtailment::Bool: plot the curtailment with the variableset_display::Bool = true: set to false to prevent the plots from displayingsave::String = "file_path": set a file path to save the plotsformat::String = "png": set a different format for saving a PlotlyJS plot. Options include "png", "pdf" and "eps"seriescolor::Array: Set different colors for the plotstitle::String = "Title": Set a title for the plotsstack::Bool = true: stack plot tracesbar::Bool: create bar plotnofill::Bool: force empty area fillstair::Bool: Make a stair plot instead of a stack plot
PowerGraphics.report — Methodreport(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 report_design.jmd (Julia markdown) file that it reads.
An example template is available here
Arguments
results::IS.Results: The results to be plottedout_path::String: folder path to the location the report should be generateddesign_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 latexbackend::Plots.AbstractBackend = Plots.gr(): sets thePlots.jlbackend
PowerGraphics.save_plot — Methodsave_plot(plot, filename)Saves plot to specified filename
Arguments
plot: plot objectfilename::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}=nothingheight::Union{Nothing,Int}=nothingscale::Union{Nothing,Real}=nothing