plotMap | R Documentation |
This function generates an interactive map that let the user visually explore the results of an Antares simulation. By default the function starts a Shiny gadget that let the user which variables to represent.
plotMap(
x,
refStudy = NULL,
mapLayout,
colAreaVar = "none",
sizeAreaVars = c(),
areaChartType = c("bar", "pie", "polar-area", "polar-radius"),
uniqueScale = FALSE,
showLabels = FALSE,
popupAreaVars = c(),
labelAreaVar = "none",
colLinkVar = "none",
sizeLinkVar = "none",
popupLinkVars = c(),
closePopupOnClick = TRUE,
type = c("detail", "avg"),
timeId = NULL,
mcYear = "average",
main = "",
typeSizeAreaVars = FALSE,
aliasSizeAreaVars = c(),
compare = NULL,
compareOpts = list(),
interactive = getInteractivity(),
options = plotMapOptions(),
width = NULL,
height = NULL,
dateRange = NULL,
xyCompare = c("union", "intersect"),
h5requestFiltering = deprecated(),
timeSteph5 = deprecated(),
mcYearh5 = deprecated(),
tablesh5 = deprecated(),
sizeMiniPlot = FALSE,
language = "en",
hidden = NULL,
...
)
x |
Object of class |
refStudy |
An object of class |
mapLayout |
Object created with function [antaresViz::mapLayout()] |
colAreaVar |
Name of a variable present in |
sizeAreaVars |
Vector of variables present in |
areaChartType |
If parameter |
uniqueScale |
If the map contains polar or bar charts, should the different variables represented use the same scale or should each variable have its own scale ? This parameter should be TRUE only if the variables have the same unit and are comparable : for instance production variables. |
showLabels |
Used only when |
popupAreaVars |
Vector of variables to display when user clicks on an area. |
labelAreaVar |
Variable to display inside the areas. This parameter is used only if
parameter |
colLinkVar |
Name of a variable present in |
sizeLinkVar |
Name of a variable present in |
popupLinkVars |
Vector of variables to display when user clicks on a link |
closePopupOnClick |
|
type |
If |
timeId |
time id present in the data. |
mcYear |
If |
main |
Title of the map. |
typeSizeAreaVars |
|
aliasSizeAreaVars |
If |
compare |
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. |
compareOpts |
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. |
interactive |
LogicalValue. If |
options |
List of parameters that override some default visual settings. See the help of [antaresViz::plotMapOptions()]. |
width |
Width of the graph expressed in pixels or in percentage of the parent element. For instance "500px" and "100%" are valid values. |
height |
Height of the graph expressed in pixels or in percentage of the parent element. For instance "500px" and "100%" are valid values. |
dateRange |
A vector of two dates. Only data points between these two dates are displayed. If NULL, then all data is displayed. |
xyCompare |
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. |
h5requestFiltering |
Contains arguments used by default for h5 request, typically h5requestFiltering = list(mcYears = 3) |
timeSteph5 |
|
mcYearh5 |
|
tablesh5 |
|
sizeMiniPlot |
|
language |
|
| |
... |
Other arguments for [manipulateWidget::manipulateWidget] |
compare argument can take following values :
"mcYear"
"type"
"colAreaVar"
"sizeAreaVars"
"areaChartType"
"showLabels"
"popupAreaVars"
"labelAreaVar"
"colLinkVar"
"sizeLinkVar"
"popupLinkVars"
"typeSizeAreaVars"
"aliasSizeAreaVars"
An htmlwidget of class "leaflet". It can be modified with package
leaflet
. By default the function starts a shiny gadget that lets the
user play with most of the parameters of the function. The function returns
a leaflet map when the user clicks on the button "OK"
.
## Not run:
mydata <- readAntares(areas = "all", links = "all", timeStep = "daily",
select = "nostat")
# Place areas on a map. Ths has to be done once for a given study. Then the
# object returned by "mapLayout" may be saved and reloaded with
# functions save and load
layout <- readLayout()
ml <- mapLayout(layout = layout)
save("ml", file = "ml.rda")
plotMap(x = mydata, mapLayout = ml)
# Specify the variables to use to control the color or size of elements.
plotMap(mydata, mapLayout = ml,
sizeAreaVars = c("WIND", "SOLAR", "H. ROR"),
sizeLinkVar = "FLOW LIN.")
# Change default graphical properties
plotMap(x = mydata, mapLayout = ml, options = list(colArea="red", colLink = "orange"))
plotMap(x = list(mydata, mydata), mapLayout = ml)
# Use custom alias
setAlias("custom_alias", "short description", c("OIL", "GAS", "COAL"))
plotMap(x = mydata, mapLayout = ml, typeSizeAreaVars = TRUE,
aliasSizeAreaVars = "custom_alias")
plotMap(x = mydata, mapLayout = ml, interactive = FALSE,
language = "fr", aliasSizeAreaVars = "Renouvelable", typeSizeAreaVars = TRUE)
# Use h5 for dynamic request / exploration in a study
# 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)
plotMap(x = opts, mapLayout = ml)
# Compare elements in a single study
plotMap(x = opts, mapLayout = ml, .compare = "mcYear")
# Compare 2 studies
plotMap(x = list(opts, opts2), mapLayout = ml)
# Compare 2 studies with argument refStudies
plotMap(x = opts, refStudy = opts2, mapLayout = ml)
plotMap(x = opts, refStudy = opts2, mapLayout = ml, interactive = FALSE, mcYearh5 = 2)
plotMap(x = opts, refStudy = opts2, mapLayout = ml, h5requestFiltering =
list(mcYears = myMcYear))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.