
Cheat sheet: Visualization
Source:vignettes/articles/cheatsheet-visualization.Rmd
cheatsheet-visualization.RmdPlots of solved scenarios, of the objects that go into a model, maps and heat maps: every one a ggplot to extend
PDF, A4, 2 pages · energyRt 0.91.5.9015 (dev) · 2026-11-29autoplot(scen)The generation mix of comm = "ELC", by year, faceted by region. Storage charging plots below zero.
autoplot(CO2CAP, "capacity", fill = "vintage", by = "vintage")by = keeps vintage or cluster apart; fill = colours by any column of the mix.
autoplot(CO2CAP, "generation", region = "R05", year = 2050, timeslice = "^d196_")A timeslice pattern that selects one day switches to an hourly profile; demand is the line.
autoplot.scenario(object, type, comm, region, year, timeslice, by, fill, facet, top_n, drop_small)getMix() returns, with the same filters."generation" |
output of comm by process (default) |
"capacity" |
installed capacity |
"new_capacity" |
capacity built in each period |
"fuel" |
inputs burnt to make comm
|
"storage" |
charge and discharge |
facet = "region" |
the default when there are several |
top_n = 6 |
the largest six; the rest is other |
drop_small = 0.01 |
hide shares under 1% |
autoplot(CO2CAP, "capacity") +
labs(title = "Installed, GW") +
theme_energyRt(base_size = 9)
p <- autoplot(CO2CAP)
ggsave("mix.png", p, width = 7,
height = 4, dpi = 300)
gg_map(CO2CAP, type = "generation", process = "EWIN", facet = "year")gg_map(object, type, level, comm, year, process, geoscale, facet, …)level = "zone" aggregates.Maps need a geoscale with geometry: the model's own, or one given with geoscale = / map =.
Last of the gallery: autoplot(compare_scenarios(list(BASE, CO2CAP))), the objective of each scenario.
gg_trade_network(CO2CAP, value = "flow", year = 2050)gg_trade_network(object, value, comm, year, timeslice, level, …)value = "capacity", "flow" or "input"; arrows scale with it.Parameters over the years, given points and interpolated lines (ECOA); a constraint's right-hand side (CO2_CAP); each process's investment and operating window (autoplot(mod)).
| technology, storage, supply, import, export | its parameters over the years; style = "profile", "bar", "regions", "map"; param = picks the slots |
| demand, weather, commodity | the series they carry |
| constraint, tax, subsidy | the bound or rate over the years |
| calendar, horizon | the time structure (Time resolution) |
| model, repository |
type = "windows" or "objects"
|
| levcost, comparisons, ensembles | their results (Levelized cost, Results) |
The diagram of a single process is draw() -- see Technology.
dem <- getData(CO2CAP, name = "pDemand",
region = "R05", year = 2050, merge = TRUE)
gg_heatmap(dem, calendar = cal, name = "GWh")
gg_heatmap(object, calendar, value, facet, name, …)timeslice column: load, profiles, prices, output.plot_map(), plot_heatmap(), plot_trade_map(), plot_trade_network(), plot_share_frontier() are the old names of the gg_*() functions; they still work and say so.
getData(list(BASE, CO2CAP),
name = "vEmsFuelTot", merge = TRUE) |>
ggplot(aes(factor(year), value,
fill = region)) +
geom_col() + facet_wrap(~scenario) +
labs(x = NULL, y = "CO2") +
theme_energyRt()
scenario column to facet on.-
autoplot()returns the plot; at the console it prints, in a script assign it orprint()it. - A scenario plot shows the active run; read another with
getData(run = )and plot that. - Values are in the model's units, labelled
value: name them withlabs(). - A per-slice plot is one occurrence of the slice; annual bars are already weighted.
EWIN, STG_ELC, WWIN, SUP_BIO and ECOA are TOPIA objects: getObject(kit$repo, name = "EWIN", drop = TRUE).