'Creating axis gap in histograms
I'm trying to create a gap in a histogram between 0.6 and 1 (on the y axis) but don't really know how to go about this. The gap.barplot solution does not seem to work and i'd love to keep the aesthetic of the plots consistent with the other ones. Ideally it would look something like this: 
The general plot code attempt looks like this:
h <- hist(benthosBx$length_mm, breaks = seq(0, 10, 0.5), plot = FALSE)
h$counts <- h$counts / nrow(benthosBx)
gap.plot(h, xlab = 'Body length (mm)', ylab = '', gap = c(0.4,0.8),ylim = c(0,0.6), xlim = c(0,10), main = ' ', xaxt='n', yaxt='n', col = "grey")
axis(side=1, at=seq(0,10, 1))
axis(side=2, at=seq(0,1, 0.1))
dput of the data:
structure(list(lakeID = c("WE2", "WE2"), length_mm = c(1.52172197930582,
1.63884515191493), date = structure(c(1592352000, 1597881600), tzone = "UTC", class = c("POSIXct",
"POSIXt")), year = c(2020L, 2020L)), row.names = c(NA, -2L), class = c("tbl_df",
"tbl", "data.frame"))
Solution 1:[1]
Set the value to zero.
plot(h, ylim = c(0,0.6), xlim = c(0,10), col = 8)
h$counts[h$breaks == 1] <- 0 ## set to zero
plot(h, ylim = c(0,0.6), xlim = c(0,10), col = 8)
Data:
set.seed(42)
h <- hist(runif(100, 0, 10), breaks = seq(0, 10, 0.5), plot = FALSE)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | jay.sf |


