R/stack_exchanges.R
, R/stack_exchanges_aliases.R
exchangesStack.Rd
This function draws a stack representing the evolution of the exchanges of
an area with its neighbours. Positive values denotes exports and negative
values imports.
User can either plot all flows from/to an area using the default
stack or use a custom one.
User can see available stacks with exchangesStackAliases
and create new ones
with setExchangesStackAlias
.
exchangesStack(
x,
stack = "default",
area = NULL,
mcYear = "average",
dateRange = NULL,
colors = NULL,
yMin = NULL,
yMax = NULL,
customTicks = NULL,
main = NULL,
ylab = NULL,
unit = c("MWh", "GWh", "TWh"),
compare = NULL,
compareOpts = list(),
interactive = getInteractivity(),
legend = TRUE,
legendId = sample(1e+09, 1),
groupId = legendId,
updateLegendOnMouseOver = TRUE,
legendItemsPerRow = 5,
width = NULL,
height = NULL,
xyCompare = c("union", "intersect"),
h5requestFiltering = deprecated(),
stepPlot = FALSE,
drawPoints = FALSE,
timeSteph5 = deprecated(),
mcYearh5 = deprecated(),
tablesh5 = deprecated(),
language = "en",
hidden = NULL,
refStudy = NULL,
...
)
exchangesStackAliases()
setExchangesStackAlias(
name,
variables,
colors,
lines = NULL,
lineColors = NULL,
lineWidth = 3,
description = NULL
)
Object of class antaresData
created with function
[antaresRead::readAntares]. It is required to contain link data.
If it also contains area data with column `ROW BAL.`, then exchanges with
the rest of the world are also displayed on the chart.
Name of the stack to use. If default
, all flows available will be plotted. One can visualize available stacks with
exchangesStackAliases
Name of a single area. The flows from/to this area will be drawn by the function.
If x
, contains multiple Monte-Carlo scenarios, this parameter
determine which scenario is displayed. Must be an integer representing the
index of the scenario or the word "average". In this case data are
averaged.
A vector of two dates. Only data points between these two dates are displayed. If NULL, then all data is displayed.
Vector of colors with same length as parameter variables
. If
variables
is an alias, then this argument should be NULL
in
order to use default colors.
numeric
, the minimum value to be displayed on all y Axis. If NULL
, the min value is automatically set
numeric
, the maximum value to be displayed on all y Axis. If NULL
, the max value is automatically set
numeric
vector of the custom ticks values to be displayed on the y Axis. If NULL
, the ticks are automatically generated
Title of the graph.
Title of the Y-axis.
Unit used in the graph. Possible values are "MWh", "GWh" or "TWh".
An optional character vector containing names of parameters. When it is set, two charts are outputed with their own input controls. Alternatively, it can be a named list with names corresponding to parameter names and values being list with the initial values of the given parameter for each chart. See details if you are drawing a map.
List of options that indicates the number of charts to create and their position. Check out the documentation of [manipulateWidget::compareOptions] to see available options.
LogicalValue. If TRUE
, then a shiny gadget is launched that lets
the user interactively choose the areas or districts to display.
Logical value indicating if a legend should be drawn. This argument is usefull when one wants to create a shared legend with [prodStackLegend()]
Id of the legend linked to the graph. This argument is usefull when one wants to create a shared legend with [prodStackLegend()]
Parameter that can be used to synchronize the horizontal zoom of multiple charts. All charts that need to be synchronized must have the same group.
LogicalValue
. If TRUE
the legend will be updated when the mouse is over a stack. If FALSE
the legend will be updated on a click
Number of elements to put in each row of the legend.
Width of the graph expressed in pixels or in percentage of the parent element. For instance "500px" and "100%" are valid values.
Height of the graph expressed in pixels or in percentage of the parent element. For instance "500px" and "100%" are valid values.
Use when you compare studies, can be "union" or "intersect". If union, all of mcYears in one of studies will be selectable. If intersect, only mcYears in all studies will be selectable.
Contains arguments used by default for h5 request, typically h5requestFiltering = list(links = getLinks(areas = myArea), mcYears = myMcYear)
boolean
, step style for curves.
boolean
, add points on graph
character
timeStep to read in h5 file. Only for Non interactive mode.
numeric
mcYear to read for h5. Only for Non interactive mode.
character
tables for h5 ("areas" "links", "clusters" or "disticts"). Only for Non interactive mode.
character
language use for label. Defaut to 'en'. Can be 'fr'.
logical
Names of input to hide. Defaut to NULL
An object of class antaresData
created with function
[antaresRead::readAntares()] containing data for areas and or
districts. Can also contains an opts who refer to a h5 file.
Other arguments for manipulateWidget
name of the stack to create or update
A named list of expressions created with [base::alist]. The name of each element is the name of the variable to draw in the stacked graph. The element itself is an expression explaining how to compute the variable (see examples).
A named list of expressions created with [base::alist]
indicating how to compute the curves to display on top of the stacked graph.
It should be NULL
if there is no curve to trace or if parameter
variables
is an alias.
Vector of colors with same length as parameter lines
. This argument
should be NULL
if there is no curve to trace or if parameter
variables
is an alias.
Optionnal. Defaut to 3. Vector of width with same length as parameter lines
(or only one value).
Description of the stack. It is displayed by function
exchangesStackAliases
.
A htmlwidget of class dygraph
. It can be modified with functions from
package dygraphs
.
Compare argument can take following values :
"mcYear"
"main"
"unit"
"area"
"legend"
"stepPlot"
"drawPoints"
if (FALSE) {
mydata <- readAntares(links = "all", timeStep = "daily")
exchangesStack(mydata)
# Also display exchanges with the rest of the world
mydata <- readAntares(areas = "all", links = "all", timeStep = "daily")
exchangesStack(mydata)
# Use compare :
exchangesStack(mydata, compare = "mcYear")
exchangesStack(mydata, compare = "area")
exchangesStack(mydata, compare = "unit")
exchangesStack(mydata, compare = "legend")
# Compare studies with refStudy argument
exchangesStack(x = myData1, refStudy = myData2)
exchangesStack(x = myData1, refStudy = myData2, interactive = FALSE)
exchangesStack(x = list(myData2, myData3, myData4), refStudy = myData1)
exchangesStack(x = list(myData2, myData3, myData4), refStudy = myData1, interactive = FALSE)
# Use h5 opts
# Set path of simulaiton
setSimulationPath(path = path1)
# Convert your study in h5 format
writeAntaresH5(path = mynewpath)
# Redefine sim path with h5 file
opts <- setSimulationPath(path = mynewpath)
exchangesStack(x = opts)
# Compare elements in a single study
exchangesStack(x = opts, .compare = "mcYear")
# Compare 2 studies
exchangesStack(x = list(opts, opts2))
# Compare 2 studies with argument refStudy
exchangesStack(x = opts, refStudy = opts2)
exchangesStack(x = opts, refStudy = opts2, interactive = FALSE, mcYearh5 = 2, areas = myArea)
exchangesStack(x = opts, refStudy = opts2, h5requestFiltering = list(
areas = getAreas(select = "a"),
links = getLinks(areas = myArea),
mcYears = myMcYear))
}