ggplot2 boxplot无法通过ggplotly()转换为plotly对象

时间:2018-12-04 23:11:54

标签: r ggplot2

我用ggplot2在下面创建了简单的箱线图。但是,当我尝试使用ggplotly()将其转换为可打印对象时,框和点会丢失。任何解决方案或替代方案?

    Drug<-c("sad","sdaad","dsad","sdd","dsdad")
    NumberOfTargets<-c(5,6,7,8,9)
    Dataset<-c("SA","SA","SA","BA","BA")
    n<-data.frame(Drug,NumberOfTargets,Dataset)
    library(ggthemes)
    g <- ggplot(n, aes(Dataset, NumberOfTargets))
    g + geom_boxplot(aes(fill=factor(Dataset))) + 
      theme(axis.text.x = element_text(angle=65, vjust=0.6)) + 
      labs(title="Box plot", 
           subtitle="City Mileage grouped by Class of vehicle",
           caption="Source: mpg",
           x="Class of Vehicle",
           y="City Mileage")
    ggplotly(g)

0 个答案:

没有答案