ecr.ebars {echarty} | R Documentation |
Custom series to display error-bars for scatter,bar or line series
ecr.ebars(wt, df = NULL, hwidth = 6, ...)
wt |
A widget to add error bars to, see createWidget |
df |
NULL(default) or data.frame with four or more columns ordered exactly (x,y,low,high,others). When NULL, data is taken from wt's dataset where order should be the same (x,y,low,high,etc) |
hwidth |
Half-width of error bar in pixels, default is 6. |
... |
More parameters for custom serie |
ecr.ebars are custom series, so ec.init(load='custom') is required.
Grouped series are supported, but require the group column to be included in df.
Will add a chart legend and its own tooltip if none is provided.
ecr.ebars with name attribute will show separate in the legend.
Command should be called last, after all other series.
A widget with error bars added if successful, otherwise the input wt
if (interactive()) {
tmp <- round(rnorm(24, sin(1:24/2)*10, .5))
df <- data.frame(x = 1:24, val = tmp,
lower = round(rnorm(24, tmp -10, .5)),
upper = round(rnorm(24, tmp + 5, .8))
)
p <- df |> ec.init(load='custom') |> ecr.ebars()
p$x$opts$tooltip <- list(show=TRUE)
p
}