Я делаю уклонение barpot в ggplot2, и одна группа имеет нулевой счет, который я хочу отобразить. Я вспомнил, что видел это на ЗДЕСЬ некоторое время назад и понял, что scale_x_discrete(drop=F)
будет работать. Кажется, что он не работает с уклонившимися барами. Как показать количество нулей?
Например, (код ниже) в приведенном ниже графике, type8 ~ group4 не имеет примеров. Мне все же хотелось бы, чтобы на графике отображалось пустое пространство для нулевого отсчета, а не устранение полосы. Как я могу это сделать?
mtcars2 <- data.frame(type=factor(mtcars$cyl),
group=factor(mtcars$gear))
m2 <- ggplot(mtcars2, aes(x=type , fill=group))
p2 <- m2 + geom_bar(colour="black", position="dodge") +
scale_x_discrete(drop=F)
p2