Skip to content
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

e_boxplot grouped by group1 where the x-axis listed by group2 #569

Open
Patrikios opened this issue Sep 14, 2023 · 1 comment
Open

e_boxplot grouped by group1 where the x-axis listed by group2 #569

Patrikios opened this issue Sep 14, 2023 · 1 comment

Comments

@Patrikios
Copy link

Image a simple data.frame with 3 columns, 2 grouping column, group1 and group2, and third value column:

df = data.frame(
  group1 = rep(c("a", "b"), 30L),
  group2 = rep(c("g1", "g2", "g3"), each = 20L),
  value = c(abs(rnorm(30)), abs(rnorm(30)) * 4)
)

I want to be able to produce comparison boxplot, where in the first case I grouped by group1 and give echarts the x axis as group2, altogether 6 box-plots comparing between members of group2 across group1

df |> 
  group_by(group1) |> # x-axis should be group1 'a' and 'b'
  e_charts(group2) |> # grouping within the group1 is 'g1', 'g2' and 'g3'
  e_boxplot(value, 
            color = rep(c("green", "orange", "red"), 2L) # colors is length of number of box-plots (2*3=6)
  )

and in the second case I grouped by group2 and give echarts the x-axis as group1, altogether 6 box-plots comparing between members of group1 (a vs b) across group1 (within g1:g3)

df |> 
  group_by(group2) |> # x-axis should be group2 'g1', 'g2' and 'g3' 
  e_charts(group1) |> # grouping within the group2 is 'a' and 'b'
  e_boxplot(value, 
            color = rep(c("#5470c6", "black"), 3L) # colors is length of number of box-plots (2*3=6)
  )

Howwever this is just my wishfull thinking, it does not work, the group_by(group1) and e_charts(group2) create x axis that consolidates the list of the values from both groups.

How can I achieve this? This is similar to https://echarts.apache.org/examples/en/editor.html?c=boxplot-multi however there is some JS applied on the data.

@Patrikios Patrikios changed the title e_boxplot by group1 where the x-axis is by group2 e_boxplot grouped by group1 where the x-axis listed by group2 Sep 14, 2023
@munoztd0
Copy link
Collaborator

munoztd0 commented Oct 2, 2023

look at #253

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants