-
Notifications
You must be signed in to change notification settings - Fork 2
Added functionality for adding additional plots #54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Zetison
wants to merge
3
commits into
main
Choose a base branch
from
enhance/additional_plots
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| # [Add Additional Plots](@id how_to-add_additional_plots) | ||
|
|
||
| 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. | ||
|
|
||
| The `additional_plots` keyword argument accepts a vector of dictionaries. Each dictionary defines one additional plot source: | ||
|
|
||
| - `"data"` (**required**): | ||
| - a `DataFrame`, or | ||
| - a path to a CSV file. | ||
| - `"normalize"` (*optional*, default `false`): | ||
| If `true`, the series is scaled before plotting, which is useful for shape comparisons with model results. | ||
|
|
||
| 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. | ||
|
|
||
| ## Example | ||
|
|
||
| Assuming you have a CSV file with additional time series data located at `path/to/your/data.csv`, for example with content | ||
|
|
||
| ```csv | ||
| sp,val1,val2 | ||
| sp1,0.5,0.6 | ||
| sp2,0.6,0.7 | ||
| sp3,0.7,0.8 | ||
| sp4,0.8,0.9 | ||
| ``` | ||
|
|
||
| you can load it into the GUI as follows: | ||
|
|
||
| ```julia | ||
| using EnergyModelsGUI | ||
|
|
||
| gui = GUI(case; additional_plots=[Dict("data"=>"path/to/your/data.csv", "normalize"=>true)]) | ||
| ``` | ||
|
|
||
| Adding a data frame directly is also possible, for example (assuming the time index is `sp1-t1`, `sp1-t2`, ..., `sp1-t10`): | ||
|
|
||
| ```julia | ||
| using EnergyModelsGUI, DataFrames | ||
|
|
||
| t = "sp1-t" .* string.(1:10) | ||
| additional_data = DataFrame(t=t, series1=rand(10), series2=rand(10)) | ||
| gui = GUI(case; additional_plots=[ | ||
| Dict("data"=>"path/to/your/data.csv", "normalize"=>true), | ||
| Dict("data"=>additional_data), | ||
| ] | ||
| ) | ||
| ``` | ||
|
|
||
| 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.