Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/68.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R 如何使分组箱线图在plotly中工作?_R_Ggplot2_Plotly - Fatal编程技术网

R 如何使分组箱线图在plotly中工作?

R 如何使分组箱线图在plotly中工作?,r,ggplot2,plotly,R,Ggplot2,Plotly,我想在R中绘出一个分组箱线图,但它根本没有显示出来 我拿了一个在ggplot中工作的箱线图,试着把它翻译成r 这是我的密码 library(fpp) library(tidyverse) library(plotly) library(Hmisc) gg <- credit %>% ggplot(aes(score, group = cut2(savings, g = 4), fill = cut2(savings, g =

我想在R中绘出一个分组箱线图,但它根本没有显示出来

我拿了一个在ggplot中工作的箱线图,试着把它翻译成r

这是我的密码

library(fpp)
library(tidyverse)
library(plotly)
library(Hmisc)
gg <-
credit %>% 
  ggplot(aes(score,
             group = cut2(savings, g = 4),
             fill = cut2(savings, g = 4))) +
  geom_boxplot() +
  coord_flip()
ggplotly(gg)
库(fpp)
图书馆(tidyverse)
图书馆(绘本)
图书馆(Hmisc)
gg%
ggplot(aes(分数、,
组=cut2(节省,g=4),
填充=切割2(节省,g=4)))+
geom_箱线图()+
coord_flip()
ggplotly(gg)

它在ggplot中显示得非常好,但在plotly中根本没有显示

如果您只是更具体地使用
plotly
code会怎么样
plotly::plot_-ly(iris,x=~Sepal.Length,y=~Species,type=“box”)
效果很好,这就是我要做的