-
-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MULTIPLE CATEGORIES BOX PLOT #253
Comments
Wow, a good 5-star question 🏆 grps <- list() # data in 3 groups
for (grp in 1:3) {
seriesData <- list()
for (i in 1:18) {
cate <- runif(10,1,200)
seriesData <- append(seriesData, list(cate))
}
tmp <- lapply(seriesData, boxplot.stats)
#browser()
grps[[grp]] <- lapply(tmp, function(x) x$stats)
}
e <- e_chart()
for (grp in 1:3) {
e$x$opts$series[[grp]] <- list(
name = paste0('category',grp),
type = 'boxplot',
data = grps[[grp]]
#tooltip = list(formatter=
# htmlwidgets::JS("function(param) { return ['Experiment ' + param.name + ': ', 'upper: ' + param.data[0], 'Q1: ' + param.data[1], 'median: ' + param.data[2],'Q3: ' + param.data[3], 'lower: ' + param.data[4] ].join('<br/>'); }"))
)
}
e$x$opts$xAxis <- list(
type = 'category',
data = as.character(1:18),
boundaryGap = TRUE,
nameGap = 30,
splitArea = list(show=TRUE),
axisLabel = list(formatter = "exprmt {value}"),
splitLine = list(show=FALSE)
)
e$x$opts$yAxis <- list(
type = 'value',
name = 'Value',
min = -200,
max = 400,
splitArea = list(show=FALSE)
)
e$x$opts$legend$data <- list('category1', 'category2', 'category3')
e$x$opts$tooltip <- list(trigger='item', axisPointer=list(type='shadow'))
e %>% e_datazoom(start = 50) Note: |
Created a gist function to do it -> https://gist.github.com/munoztd0/c860717d1f29e8a1b9114c46e945202e |
Hi John, many thank for the amazing package, I have the next issue/doubt: I want to plot multiple categories in box-plot like: https://echarts.apache.org/examples/en/editor.html?c=boxplot-multi
Maybe I am wrong but, Currently you can group_by one category and it work well, by contrast, if you by two or more categories it does not work.
Is there any way to group by more than one category? thank you in advance
The text was updated successfully, but these errors were encountered: