histogram_1d_plotly: Plot multi-trace 1-d histograms with plotly.

Description Usage Arguments Details Value Examples

View source: R/plot_aggregates.R

Description

histogram_1d_plolty plots multi-trace 1-d histograms with plotly.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
histogram_1d_plotly(
  df,
  var,
  groupby_var = NULL,
  plot_type = c("histogram"),
  breaks = "FD",
  density = TRUE,
  orientation = c("v", "h"),
  margin = 0.02,
  return_type = c("subplot", "list")
)

Arguments

df

A data.frame.

var

A character or (named) charactor vector. Character of the columns to be used for plotting histograms.

groupby_var

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

plot_type

for future use, currently "histogram".

breaks

breaks from graphics::hist.

density

TRUE for density, FALSE for counts.

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. Not currently used.

margin

float. margin argument in subplot call.

return_type

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

Details

This is a function to plot multi-trace 1-d histograms using plotly package. Multiple variables can be plot, and organized as subplots. Groupby variable(s) 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. The subplot is ncol = length(in_var), nrow = length(de_var)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
histogram_1d_plotly(df,
  var = c("column1", "column2"),
  groupby_var = c("group_column1", "group_column2"),
  breaks = "FD",
  density = TRUE,
  margin = 0.02,
  orientation = "v", return_type = "subplot")

## End(Not run)

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