Since log(0)
is -Inf
, I suspect that your 0th item will always be truncated if you leave it at zero. I tried to mess with expand=...
, coord_trans
and everything else I could think of.
Here is a workaround:
- set null values ββto an arbitrary small value (say 1e-6)
- includes a gap at this value
- optionally indicate break 0
Code:
myData <- data.frame(x = c(rexp(5), 0), y = "category") myData <- within(myData, x[x==0] <- 1e-6) myBreaks <- c(1e-6, 0.1, 1, 5) myLabels <- c(0, myBreaks[-1]) ggplot(myData, aes(x = x, y = y)) + geom_point(size = 5, legend = F) + scale_x_continuous( trans = "log", breaks = myBreaks, labels = myLabels )

source share