This function generates an interactive plot of an antares time series.

tsPlot(
  x,
  refStudy = NULL,
  table = NULL,
  variable = NULL,
  elements = NULL,
  variable2Axe = NULL,
  mcYear = "average",
  type = c("ts", "barplot", "monotone", "density", "cdf", "heatmap"),
  dateRange = NULL,
  typeConfInt = FALSE,
  confInt = 0,
  minValue = NULL,
  maxValue = NULL,
  aggregate = c("none", "mean", "sum", "mean by areas", "sum by areas"),
  compare = NULL,
  compareOpts = list(),
  interactive = getInteractivity(),
  colors = NULL,
  main = NULL,
  ylab = NULL,
  legend = TRUE,
  legendItemsPerRow = 5,
  colorScaleOpts = colorScaleOptions(20),
  width = NULL,
  height = NULL,
  xyCompare = c("union", "intersect"),
  h5requestFiltering = list(),
  highlight = FALSE,
  stepPlot = FALSE,
  drawPoints = FALSE,
  secondAxis = FALSE,
  timeSteph5 = "hourly",
  mcYearh5 = NULL,
  tablesh5 = c("areas", "links"),
  language = "en",
  hidden = NULL,
  ...
)

# S3 method for antaresData
plot(
  x,
  refStudy = NULL,
  table = NULL,
  variable = NULL,
  elements = NULL,
  variable2Axe = NULL,
  mcYear = "average",
  type = c("ts", "barplot", "monotone", "density", "cdf", "heatmap"),
  dateRange = NULL,
  typeConfInt = FALSE,
  confInt = 0,
  minValue = NULL,
  maxValue = NULL,
  aggregate = c("none", "mean", "sum", "mean by areas", "sum by areas"),
  compare = NULL,
  compareOpts = list(),
  interactive = getInteractivity(),
  colors = NULL,
  main = NULL,
  ylab = NULL,
  legend = TRUE,
  legendItemsPerRow = 5,
  colorScaleOpts = colorScaleOptions(20),
  width = NULL,
  height = NULL,
  xyCompare = c("union", "intersect"),
  h5requestFiltering = list(),
  highlight = FALSE,
  stepPlot = FALSE,
  drawPoints = FALSE,
  secondAxis = FALSE,
  timeSteph5 = "hourly",
  mcYearh5 = NULL,
  tablesh5 = c("areas", "links"),
  language = "en",
  hidden = NULL,
  ...
)

# S3 method for simOptions
plot(
  x,
  refStudy = NULL,
  table = NULL,
  variable = NULL,
  elements = NULL,
  variable2Axe = NULL,
  mcYear = "average",
  type = c("ts", "barplot", "monotone", "density", "cdf", "heatmap"),
  dateRange = NULL,
  typeConfInt = FALSE,
  confInt = 0,
  minValue = NULL,
  maxValue = NULL,
  aggregate = c("none", "mean", "sum", "mean by areas", "sum by areas"),
  compare = NULL,
  compareOpts = list(),
  interactive = getInteractivity(),
  colors = NULL,
  main = NULL,
  ylab = NULL,
  legend = TRUE,
  legendItemsPerRow = 5,
  colorScaleOpts = colorScaleOptions(20),
  width = NULL,
  height = NULL,
  xyCompare = c("union", "intersect"),
  h5requestFiltering = list(),
  highlight = FALSE,
  stepPlot = FALSE,
  drawPoints = FALSE,
  secondAxis = FALSE,
  timeSteph5 = "hourly",
  mcYearh5 = NULL,
  tablesh5 = c("areas", "links"),
  language = "en",
  hidden = NULL,
  ...
)

# S3 method for list
plot(
  x,
  refStudy = NULL,
  table = NULL,
  variable = NULL,
  elements = NULL,
  variable2Axe = NULL,
  mcYear = "average",
  type = c("ts", "barplot", "monotone", "density", "cdf", "heatmap"),
  dateRange = NULL,
  typeConfInt = FALSE,
  confInt = 0,
  minValue = NULL,
  maxValue = NULL,
  aggregate = c("none", "mean", "sum", "mean by areas", "sum by areas"),
  compare = NULL,
  compareOpts = list(),
  interactive = getInteractivity(),
  colors = NULL,
  main = NULL,
  ylab = NULL,
  legend = TRUE,
  legendItemsPerRow = 5,
  colorScaleOpts = colorScaleOptions(20),
  width = NULL,
  height = NULL,
  xyCompare = c("union", "intersect"),
  h5requestFiltering = list(),
  highlight = FALSE,
  stepPlot = FALSE,
  drawPoints = FALSE,
  secondAxis = FALSE,
  timeSteph5 = "hourly",
  mcYearh5 = NULL,
  tablesh5 = c("areas", "links"),
  language = "en",
  hidden = NULL,
  ...
)

Arguments

x

Object of class antaresData. Alternatively, it can be a list of antaresData objects. In this case, one chart is created for each object. Can also be opts object from h5 file or list of opts object from h5 file.

refStudy

An object of class antaresData created with function readAntares containing data for areas and or districts. Can also contains an opts who refer to a h5 file.

table

Name of the table to display when x is an antaresDataList object.

variable

Name of the variable to plot. If this argument is missing, then the function starts a shiny gadget that let the user choose the variable to represent. When the user clicks on the "Done" button", the graphic is returned by the function.

elements

Vector of "element" names indicating for which elements of 'x' should the variable be plotted. For instance if the input data contains areas, then this parameter should be a vector of area names. If data contains clusters data, this parameter has to be the concatenation of the area name and the cluster name, separated by " > ". This is to prevent confusion when two clusters from different areas have the same name.

variable2Axe

character, variables on second axis.

mcYear

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.

type

Type of plot to draw. "ts" creates a time series plot, "barplot" creates a barplot with one bar per element representing the average value of the variable for this element. "monotone" draws the monotone curve of the variable for each element.

dateRange

A vector of two dates. Only data points between these two dates are displayed. If NULL, then all data is displayed.

typeConfInt

logical. If multiple Monte Carlo scenarios are present in the input data, see all curves (FALSE, Default), or mean and confidence interval (TRUE)

confInt

Number between 0 and 1 indicating the size of the confidence interval to display. If it equals to 0, then confidence interval is not computed nor displayed. Used only when multiple Monte Carlo scenarios are present in the input data.

minValue

Only used if parameter type is "density" or "cdf". If this parameter is set, all values that are less than minValue are removed from the graphic. This is useful to deal with variables containing a few extreme values (generally cost and price variables). If minValue is unset, all values are displayed.

maxValue

Only used if parameter type is "density" or "cdf". If this parameter is set, all values not in [-minValue, maxValue] are removed from the graphic. This is useful to deal with variables containing a few extreme values (generally cost and price variables). If maxValue is 0 or unset, all values are displayed.

aggregate

When multiple elements are selected, should the data be aggregated. If "none", each element is represented separetly. If "mean" values are averaged and if "sum" they are added. You can also compute mean ans sum by areas.

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 compareOptions to see available options.

interactive

LogicalValue. If TRUE, then a shiny gadget is launched that lets the user interactively choose the areas or districts to display.

colors

Vector of colors

main

Title of the graph.

ylab

Label of the Y axis.

legend

Logical value indicating if a legend should be drawn. This argument is usefull when one wants to create a shared legend with prodStackLegend

legendItemsPerRow

Number of elements to put in each row of the legend.

colorScaleOpts

A list of parameters that control the creation of color scales. It is used only for heatmaps. See colorScaleOptions() for available parameters.

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.

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 = 2)

highlight

highlight curve when mouse over

stepPlot

boolean, step style for curves.

drawPoints

boolean, add points on graph

secondAxis

add second axis to graph

timeSteph5

character timeStep to read in h5 file. Only for Non interactive mode.

mcYearh5

numeric mcYear to read for h5. Only for Non interactive mode.

tablesh5

character tables for h5 ("areas" "links", "clusters" or "disticts"). Only for Non interactive mode.

language

character language use for label. Defaut to 'en'. Can be 'fr'.

hidden

logical Names of input to hide. Defaut to NULL

...

Other arguments for manipulateWidget

Value

The function returns an object of class "htmlwidget". It is generated by package highcharter if time step is annual or by dygraphs for any other time step.It can be directly displayed in the viewer or be stored in a variable for later use.

Details

If the input data contains several Monte-Carlo scenarios, the function will display the evolution of the average value. Moreover it will represent a 95

If the input data has a annual time step, the function creates a barplot instead of a line chart.

compare argument can take following values :

  • "mcYear"

  • "main"

  • "variable"

  • "type"

  • "typeConfInt"

  • "confInt"

  • "elements"

  • "aggregate"

  • "legend"

  • "highlight"

  • "stepPlot"

  • "drawPoints"

  • "secondAxis"

Examples