jbkunst / highcharter

R wrapper for highcharts
http://jkunst.com/highcharter/
Other
718 stars 147 forks source link

Outliers in boxplot with two grouping variables occur in the middle (and have unexpected color) #738

Closed zross closed 1 year ago

zross commented 2 years ago

@jbkunst this issue is probably a variation on #519. I'm not sure if it is expected or wanted behavior but I wouldn't think so. You can see that with one group_var it works fine but with the second, group_var2 the outliers occur in the middle and in the example below are in orange and green.

I would expect the outlier to be associated with one of the six boxes rather than in the middle of the two.

Using group_var

library(highcharter)

mtcars$mpg[c(1, 3)] <- 60 #add outliers

dat <- data_to_boxplot(
  mtcars,
  mpg,
  group_var = cyl,
  #group_var2 = vs,
  add_outliers = TRUE
) 

highchart() %>%
  hc_xAxis(
    type = "category"
  ) %>%
  hc_add_series_list(dat)

image

Using group_var and group_var2

mtcars$mpg[c(1, 3)] <- 60 #add outliers

dat <- data_to_boxplot(
  mtcars,
  mpg,
  group_var = cyl,
  group_var2 = vs,
  add_outliers = TRUE
) 

highchart() %>%
  hc_xAxis(
    type = "category"
  ) %>%
  hc_add_series_list(dat)

image

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Feel free to reopen it if you find it necessary.