2

我希望在背景网格中添加一条额外的白线和一个额外的刻度线,但仅在小面Low Tide内,这有可能吗?

我想我可以在Low Tide或类似的命令中添加一个中断(在y = 10处)(请参阅下面的代码)。scale_y_continuous()

_break_ 到 <code>scale_y_continuous()</code>

require(ggplot2)
df <- data.frame(cyl = mtcars[,2])
df$Tide  <- ifelse(df$cyl > 4, c('High Tide'), c('Low Tide'))
c <- ggplot(df, aes(factor(cyl)))
c + geom_bar(fill="white", colour="darkgreen", alpha=0.5) +
       facet_grid(. ~ Tide, scales = "free", space = "free") +
       scale_y_continuous(breaks=c(4, 6, 8),
          labels=c("Minimal", "Mild", "Moderate")) +
       scale_x_discrete(breaks=c(6,8,4),
          labels=c("East Coast", "West Coast", "West Coast Summer")) + 
       theme(axis.title.x = element_blank(), axis.title.y  = element_blank(), 
          axis.ticks.x = element_blank(), legend.position = "none") 
4

0 回答 0