PowerGraphics API
PowerGraphics.load_palette
— Methodload_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
PowerGraphics.plot_dataframe!
— Methodplot_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 handledf::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 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 plotseriescolor::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 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 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 plotseriescolor::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, results)
plot_demand!(plot, system)
This function makes a plot of the demand in the system.
Arguments
plot
: existing plot handleresult::Union{IS.Results, PSY.System}
: simulation results or PowerSystems.System
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 other 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 plotseriescolor::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)
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 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 plotseriescolor::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)
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 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 plotseriescolor::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)
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 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 plotseriescolor::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)
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 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 plotseriescolor::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)
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 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 plotseriescolor::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)
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 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 plotseriescolor::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 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 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.backend() = plotlyjs()
: sets the plots backend, default is gr()
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}=nothing
height::Union{Nothing,Int}=nothing
scale::Union{Nothing,Real}=nothing