小编Qia*_*eng的帖子

ggplotly 和 facet_wrap 的 X 轴错误

我正在尝试使用 ggplotly 和 facet_wrap 创建条形图。但是,第二个和第三个子图的 x 轴看起来很奇怪。下面是我的代码:

library(plotly)
library(ggplot2)
library(dplyr)

setInfo<- data.frame(sampleNumber=rep(c("A","B","C"),4),
                     Category=rep(c("Class 1", "Class 2","Class 3"),4),
                     Value=rep(1,12))

setInfo %>% 
  ggplot(aes(sampleNumber,fill = sampleNumber))+
  geom_bar()+
  facet_wrap(~Category,nrow = 1,scales = "free_x")->plot_this

ggplotly(plot_this)
Run Code Online (Sandbox Code Playgroud)

r ggplot2 plotly ggplotly

5
推荐指数
1
解决办法
120
查看次数

标签 统计

ggplot2 ×1

ggplotly ×1

plotly ×1

r ×1