Skip to content

Commit 7a110db

Browse files
committed
Add suggestion from review
1 parent 5435f93 commit 7a110db

2 files changed

Lines changed: 50 additions & 0 deletions

File tree

docs/make.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ makedocs(;
5252
"Customize descriptive_names"=>"how-to/customize-descriptive_names.md",
5353
"Improve performance"=>"how-to/improve-performance.md",
5454
"Use custom backgroun map"=>"how-to/use-custom-background-map.md",
55+
"Add additional plots"=>"how-to/add_additional_plots.md",
5556
],
5657
"Library" => Any[
5758
"Public"=>"library/public.md",
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# [Add Additional Plots](@id how_to-add_additional_plots)
2+
3+
Use the `additional_plots` keyword in the [`GUI(::Case; kwargs...)`](@ref) constructor to add external time series (or other indexed series) in the results axis, alongside model data.
4+
5+
The `additional_plots` keyword argument accepts a vector of dictionaries. Each dictionary defines one additional plot source:
6+
7+
- `"data"` (**required**):
8+
- a `DataFrame`, or
9+
- a path to a CSV file.
10+
- `"normalize"` (*optional*, default `false`):
11+
If `true`, the series is scaled before plotting, which is useful for shape comparisons with model results.
12+
13+
The time index of the additional data must match the time index of the model results. The time index column must be named one of the following `t`, `sp`, `rp`, `osc`, `op`. If this column is missing, an `OperationalProfile` will be created for the additional data (where the time index is inferred based on the row order to match the time structure of the model case), and a warning will be issued.
14+
15+
## Example
16+
17+
Assuming you have a CSV file with additional time series data located at `path/to/your/data.csv`, for example with content
18+
19+
```csv
20+
sp,val1,val2
21+
sp1,0.5,0.6
22+
sp2,0.6,0.7
23+
sp3,0.7,0.8
24+
sp4,0.8,0.9
25+
```
26+
27+
you can load it into the GUI as follows:
28+
29+
```julia
30+
using EnergyModelsGUI
31+
32+
gui = GUI(case; additional_plots=[Dict("data"=>"path/to/your/data.csv", "normalize"=>true)])
33+
```
34+
35+
Adding a data frame directly is also possible, for example (assuming the time index is `sp1-t1`, `sp1-t2`, ..., `sp1-t10`):
36+
37+
```julia
38+
using EnergyModelsGUI, DataFrames
39+
40+
t = "sp1-t" .* string.(1:10)
41+
additional_data = DataFrame(t=t, series1=rand(10), series2=rand(10))
42+
gui = GUI(case; additional_plots=[
43+
Dict("data"=>"path/to/your/data.csv", "normalize"=>true),
44+
Dict("data"=>additional_data),
45+
]
46+
)
47+
```
48+
49+
After loading the GUI the additional series are available in the **Available data** menu (make sure not to have any element selected), and can be selected for plotting alongside model results.

0 commit comments

Comments
 (0)