ecr.ebars {echarty}R Documentation

Error bars

Description

Custom series to display error bars for scatter,bar or line series

Usage

ecr.ebars(wt, df, hwidth = 6, ...)

Arguments

wt

A widget to add error bars to, see createWidget

df

A data.frame with three or more columns in order x,low,high,etc.

hwidth

Half-width of error bar in pixels, default is 6.

...

More parameters for custom serie

Details

Grouped bars are supported, but require the group column to be included in df.
Complete data frame df could be chained to ec.init to auto-populate the bar series.
ecr.ebars will add a legend if none is found.
ecr.ebars are custom series, so ec.init(load='custom') is required. ecr.ebars should be set at the end, after all other series.

Value

A widget with error bars added if successful, otherwise input wt

Examples

library(dplyr)
df <- mtcars %>% group_by(cyl,gear) %>% summarise(mmm=mean(mpg)) %>% 
  mutate(low=mmm*(1-0.2*runif(1)), high=mmm*(1+0.2*runif(1))) %>% 
  relocate(cyl, .after = last_col())   # move group column away from first three cols
p <- df %>% ec.init(group1='bar', load='custom')
# since this is grouped data, must include the group column 'cyl'
ecr.ebars(p, df[,c('gear','low','high','cyl')])


[Package echarty version 0.2.0 Index]