I’m making a dotchart where I want to log transform the x scale. I have some points at 0, which ggplot handles nicely in that it doesn’t eliminate them, however it does clip them.
What can I do so the points at 0 don’t get clipped? It seems xlim() and the scale transformation don’t play together, only the last one called takes effect.
An example:
myData <- data.frame(x = c(rexp(5), 0), y = "category")
myBreaks <- c(.1, 1, 5)
ggplot(myData, aes(x = x, y = y)) +
scale_x_continuous(trans = "log",
breaks = myBreaks,
labels = myBreaks) +
geom_point(size = 5, legend = F)

Since
log(0)is-Inf, I suspect that your 0 point will always be clipped if you keep it zero. I tried to fiddle withexpand=...,coord_transand everything else I could think of.Here is a workaround:
The code: