plotly_build_light {shinyHugePlot}R Documentation

Build plotly data with low computation cost

Description

Before illustrating data using plotly, it must be built (figure$x$data are need to be made using figure$x$attrs). However, because a lot of procedures are necessary, the computation cost is relatively high. With this function, the data is built in quite short time by omitting several procedures for high-frequency data. Note that this function is not universally applicable to all plotly objects but made for high-frequency scatter data. plotly::plotly_build function may return better results in specific cases although it takes more time.

Usage

plotly_build_light(fig, vars_hf = c("x", "y", "text", "hovertext"))

Arguments

fig

plotly object. Note that fig$x$attrs is not NULL and each fig$x$attrs element has an element named x. This function generates fig$x$data using fig$x$attrs.

vars_hf

Character, optional. Variable names where high frequency data is included. It must include x.

Value

built plotly object

Examples

data(noise_fluct)
plotly_build_light(
  plotly::plot_ly(
    x = noise_fluct$time,
    y = noise_fluct$f500,
    name = "level",
    type = "scatter"
  )
)

plotly_build_light(
  plotly::plot_ly(
    data = noise_fluct,
    x = ~time,
    y = ~f500,
    name = "level",
    type = "scatter"
  )
)


[Package shinyHugePlot version 0.2.6 Index]