R 按组拆分打印框式打印x轴
我有来自R 按组拆分打印框式打印x轴,r,split,plotly,boxplot,facet,R,Split,Plotly,Boxplot,Facet,我有来自n组s(在本例2中:A和B)的数据,其中对于每个组,我有m复制(x,在本例3中),每个组都有z测量(y)(在本例中为100): 虽然我似乎无法弄清楚X轴标签只能在中间出现一次。 但是,我的问题是,这是否可以在单个绘图中实现(即,不使用子绘图组合绘图的列表) 我认为这可能会: plot_ly(data = df, x =~ x, y =~ y, split =~ group, type = "box", showlegend = F, color =~ group) %>% l
n
组
s(在本例2中:A
和B
)的数据,其中对于每个组,我有m
复制(x
,在本例3中),每个组都有z
测量(y
)(在本例中为100):
虽然我似乎无法弄清楚X轴标签只能在中间出现一次。
但是,我的问题是,这是否可以在单个绘图
中实现(即,不使用子绘图组合绘图的列表
)
我认为这可能会:
plot_ly(data = df, x =~ x, y =~ y, split =~ group, type = "box", showlegend = F, color =~ group) %>%
layout(xaxis = list(title = "Replicate", zeroline = F), yaxis = list(title = "Y", zeroline = F))
但它似乎并不是将x轴按组进行拆分:
有什么想法吗?添加布局(boxmode=“group”)
。请参阅:
A.plot <- plot_ly(data = dplyr::filter(df, group == "A"),x =~ x, y =~ y, type = "box", showlegend = F, color =~ group, colors = "blue") %>%
layout(xaxis = list(title = "Replicate", zeroline = F), yaxis = list(title = "Y", zeroline = F))
B.plot <- plot_ly(data = dplyr::filter(df, group == "B"),x =~ x, y =~ y, type = "box", showlegend = F, color =~ group, colors = "green") %>%
layout(xaxis = list(title = "Replicate", zeroline = F), yaxis = list(title = "Y", zeroline = F))
subplot(list(A.plot, B.plot), shareY = T, shareX = F, titleX = T, titleY = T)
plot_ly(data = df, x =~ x, y =~ y, split =~ group, type = "box", showlegend = F, color =~ group) %>%
layout(xaxis = list(title = "Replicate", zeroline = F), yaxis = list(title = "Y", zeroline = F))
plot_ly(mtcars, x = ~as.factor(cyl), y = ~mpg, color = ~as.factor(gear), type = "box") %>%
layout(boxmode = "group")