shinyHugePlotThis 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.
shiny_hugeplot(obj, ...)# S3 method for default
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 formula
shiny_hugeplot(
obj = NULL,
srcs = 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 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 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 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 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 downsampler
shiny_hugeplot(
obj,
run_shiny = TRUE,
shiny_options = list(),
width = "100%",
height = "600px",
verbose = FALSE,
...
)
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.
If a formula is given, the data will be saved and loaded using duck-db.
The sources of the data (srcs) must be given as a character string
Not used.
Numeric vector, optional.
y values of the figure of shiny application,
which is required if the obj argument is used as the x values.
Timezone, optional.
It is used to convert the nanotime to the time displayed in the figure.
By default, Sys.timezone().
Boolean, optional.
Whether shinyHugePlot::plotly_build_light will be used.
(if FALSE, plotly::plotly_build will be used)
By default, TRUE.
Named list, optional.
Arguments passed to plotly::plot_ly.
Named list, optional.
Arguments passed to plotly::layout.
Instance of R6 classes for aggregating data, optional.
The classes can be listed using list_aggregators.
By default, min_max_aggregator$new().
Integer, optional. Number of samples get by the down-sampling. By default, 1000.
Boolean, optional.
whether a generated shiny application will be launched.
By default, TRUE.
Named list, optional.
Arguments passed to downsampler$new.
Note that use aggregator and n_out arguments
if you want to set these arguments.
Named list, optional.
Arguments passed to shinyApp function.
Character, optional.
Arguments passed to plotlyOutput.
By default, 100% and 600px.
Boolean.
Whether detailed messages to check the procedures are shown. By default, FALSE.
Character, used when a formula is given as the obj.
Named list, optional.
Arguments passed to data.table::fread,
which is used if a single character string is given as the obj.
# \donttest{
data(noise_fluct)
shiny_hugeplot(noise_fluct$f500)
shiny_hugeplot(noise_fluct$time, noise_fluct$f500)
# }
Run the code above in your browser using DataLab