multi_trace_plotly: Plot multi-trace subplots with plotly.

Description Usage Arguments Details Value Examples

View source: R/plot_aggregates.R

Description

multi_trace_plotly plots multi-trace subplots with plotly.

Usage

1
2
3
4
5
6
7
8
9
multi_trace_plotly(
  df,
  in_var,
  de_var,
  groupby_var = NULL,
  plot_type = list(type = "scatter", mode = "lines"),
  orientation = c("v", "h"),
  return_type = c("subplot", "list")
)

Arguments

df

A data.frame.

in_var

A character. Character of the column to be used for independent variable, typically x axis in "vertical" orientation.

de_var

A character, or (named) charactor vector, or (named) list of character vector. The structure will determine how the dependent variables are arranged into multi-axis subplots, typically y axis in "vertical" orientation.

groupby_var

A character, or character vector. Character of the column(s) to be used for grouping, currently implemented by linetype.

plot_type

Named list for plotly type, mode, etc.

orientation

"v" or "h", for "vertical" and "horizontal". v (vertical) is the common x/y arrangement e.g. top edge, h (horizontal) is the uncommon x/y arrangement e.g. right edge.

return_type

"subplot" or "list". return_type should be subplot or list of plots.

Details

This is a function to plot multi-trace subplots using plotly package. Multiple dependent variables are plot agains independent variable. Dependent variables can be organized/combined in different subplots. Groupby variable and plot types can be controlled. The plots can be both vertical (default) and horizontal orientations. It can return either subplots or a list of plotly objects.

Value

A plotly (subplot) object or a list of plotly objects depending on return_type.

Examples

1
2
3
4
5
6
7
8
## Not run: 
multi_trace_plotly(df, in_var = "x_column",
  de_var = c("y_column1", "y_column2"),
  groupby_var = "z_column",
  plot_type = list(type = "scatter", mode = "lines"),
  orientation = "v", return_type = "subplot")

## End(Not run)

xiangnandang/rsubplotly documentation built on May 6, 2020, 12:37 a.m.