I would like interactive (this means that they can be selected with the choice of box / lasso) trembling dots that will be displayed on the grouped strong> box . I got out of this question: Add jitter to the field using markers in the plot . I want exactly the same, but the boxes must be grouped.
I made a box, but all the points mixed up:
dat %>%
plot_ly(x = ~as.numeric(IC),
y = ~xval,
color = ~gene,
type = "box",
hoverinfo = "none",
boxpoints = FALSE
) %>%
add_markers(x = ~jitter(as.numeric(IC)),
y = ~xval,
color = ~gene,
marker = list(size = 3),
hoverinfo = "text",
text = txt,
showlegend = TRUE) %>%
layout(boxmode = "group")

When I try to make the X axis grouped by coefficient (so that each combination is a level), I cannot group my block plotter:
dat <- dat %>%
mutate(gene_x_covariate = as.factor(
paste0(get(facet_title), "-", gene)))
dat %>%
plot_ly(x = ~as.numeric(gene_x_covariate),
y = ~xval,
color = ~gene,
type = "box",
hoverinfo = "none",
boxpoints = FALSE
) %>%
add_markers(x = ~jitter(as.numeric(gene_x_covariate)),
y = ~xval,
color = ~gene,
marker = list(size = 3),
hoverinfo = "text",
text = txt,
showlegend = TRUE) %>%
layout(boxmode = "group")

When I try to mix the variables along the X axis, I get points from the boxes:
dat %>%
plot_ly(x = ~as.numeric(IC),
y = ~xval,
color = ~gene,
type = "box",
hoverinfo = "none"
) %>%
add_markers(x = ~jitter(as.numeric(gene_x_covariate)),
y = ~xval,
color = ~gene,
marker = list(size = 3),
hoverinfo = "text",
text = txt,
showlegend = TRUE) %>%
layout(boxmode = "group")

Any ideas?