Hello. I am trying to produce a plot with a discontinuous y-axis but can't get the facet titles to only show once:
data(mpg) library(ggplot2) > ggplot(mpg, aes(displ, cty)) + + geom_point() + + facet_grid(. ~ drv)
After much digging it appears that this is impossible in
ggplot2, but I have discovered the
gg.gap package. However, this package replicates the facet titles for each segment of the plot. Let's say I want a break in the y axis from 22-32 as follows:
library(gg.gap) gg.gap(plot = p, segments = c(22, 32), ylim = c(0, 35))
Nirgrahamuk's solution seems to work for bar plots, but does not work when plotting with facets. Facet titles still appear for each plot segment. I would be grateful for any insight of help anyone could provide! I'm stumped.
I know this is possible if I plot in base R, but given other constraints I am unable to do so.