shiny_hugeplot {shinyHugePlot}R Documentation

Wrapper for plotting large-sized data using shinyHugePlot

Description

This is a S3 class function to easily plot large-sized data using downsampler object including plotly and shiny application. Using data that is given as a first argument, shiny application will be constructed and (by default,) executed. As the first argument, many classes are applicable, ranging from a numeric vector representing y values to a downsampler object containing original data, layout of the figure and options for aggregating the original data.

Usage

shiny_hugeplot(obj, ...)

## Default S3 method:
shiny_hugeplot(
  obj = NULL,
  y = NULL,
  tz = Sys.timezone(),
  use_light_build = TRUE,
  plotly_options = list(type = "scatter", mode = "lines"),
  plotly_layout_options = list(),
  aggregator = min_max_aggregator$new(),
  n_out = 1000L,
  run_shiny = TRUE,
  downsampler_options = list(),
  shiny_options = list(),
  width = "100%",
  height = "600px",
  verbose = FALSE,
  ...
)

## S3 method for class 'character'
shiny_hugeplot(
  obj = NULL,
  n_out = 1000L,
  aggregator = min_max_aggregator$new(),
  run_shiny = TRUE,
  use_light_build = TRUE,
  fread_options = list(),
  downsampler_options = list(),
  plotly_options = list(type = "scatter", mode = "lines"),
  plotly_layout_options = list(),
  shiny_options = list(),
  width = "100%",
  height = "600px",
  verbose = FALSE,
  ...
)

## S3 method for class 'matrix'
shiny_hugeplot(
  obj = NULL,
  n_out = 1000L,
  aggregator = min_max_aggregator$new(),
  run_shiny = TRUE,
  use_light_build = TRUE,
  downsampler_options = list(),
  plotly_options = list(type = "scatter", mode = "lines"),
  plotly_layout_options = list(),
  shiny_options = list(),
  width = "100%",
  height = "600px",
  verbose = FALSE,
  ...
)

## S3 method for class 'data.frame'
shiny_hugeplot(
  obj = NULL,
  tz = Sys.timezone(),
  n_out = 1000L,
  aggregator = min_max_aggregator$new(),
  run_shiny = TRUE,
  use_light_build = TRUE,
  downsampler_options = list(),
  plotly_options = list(type = "scatter", mode = "lines"),
  plotly_layout_options = list(),
  shiny_options = list(),
  width = "100%",
  height = "600px",
  verbose = FALSE,
  ...
)

## S3 method for class 'plotly'
shiny_hugeplot(
  obj,
  n_out = 1000L,
  aggregator = min_max_aggregator$new(),
  run_shiny = TRUE,
  use_light_build = TRUE,
  downsampler_options = list(),
  shiny_options = list(),
  width = "100%",
  height = "600px",
  verbose = FALSE,
  ...
)

## S3 method for class 'downsampler'
shiny_hugeplot(
  obj,
  run_shiny = TRUE,
  shiny_options = list(),
  width = "100%",
  height = "600px",
  verbose = FALSE,
  ...
)

Arguments

obj

Numeric/nanotime/POSIXt vector, numeric matrix, data.frame, single character string, plotly object, or downsampler object. If a numeric vector is given, it will be used as y values of the figure of the shiny application (the x values are calculated by seq_along(obj)). It will be interpreted as the x values if you use y argument together. If a nanotime (see nanotime package) vector is given, it will be used as the x values (y argument is mandatory). If a numeric matrix is given, which must have more than 2 columns, the first and second column values will be used as the x and y values. If a data frame is given, which must have columns named x and y, these columns will be used as the x and y values. If a single character string is given, it will be used as a file path to obtain a data frame (data frame will be loaded using data.table::fread). If a plotly object is given, the data and layout of it will be used for constructing the figure of the shiny application. If a downsampler object is given, the data, layout, and down-sampling options for aggregating original data of it will be used for constructing shiny application.

...

Not used.

y

Numeric vector, optional. y values of the figure of shiny application, which is required if the obj argument is used as the x values.

tz

Timezone, optional. It is used to convert the nanotime to the time displayed in the figure. By default, Sys.timezone().

use_light_build

Boolean, optional. Whether shinyHugePlot::plotly_build_light will be used. (if FALSE, plotly::plotly_build will be used) By default, TRUE.

plotly_options

Named list, optional. Arguments passed to plotly::plot_ly.

plotly_layout_options

Named list, optional. Arguments passed to plotly::layout.

aggregator

Instance of R6 classes for aggregating data, optional. The classes can be listed using list_aggregators. By default, min_max_aggregator$new().

n_out

Integer, optional. Number of samples get by the down-sampling. By default, 1000.

run_shiny

Boolean, optional. whether a generated shiny application will be launched. By default, TRUE.

downsampler_options

Named list, optional. Arguments passed to downsampler$new. Note that use aggregator and n_out arguments if you want to set these arguments.

shiny_options

Named list, optional. Arguments passed to shinyApp function.

width, height

Character, optional. Arguments passed to plotlyOutput. By default, 100% and 600px.

verbose

Boolean. Whether detailed messages to check the procedures are shown. By default, FALSE.

fread_options

Named list, optional. Arguments passed to data.table::fread, which is used if a single character string is given as the obj.

Examples


data(noise_fluct)

shiny_hugeplot(noise_fluct$f500)
shiny_hugeplot(noise_fluct$time, noise_fluct$f500)


[Package shinyHugePlot version 0.2.6 Index]