R version 3.1.1 (2014-07-10) Platform: i386-w64-mingw32/i386 (32-bit)
I am working on a histogram with ggplot2
. Since I have heavily tailed data, I would like to use axis "clip marks" at the end of the x-axis in ggplot like in the following example. (not the red 0.95 quantile but the small black clip marks at the end of the x axis)
The question is not about a break within the axis as asked in Using ggplot2, can I insert a break in the axis? but about clipping of the end of the axis and adding a marker, that the reader of the plot can immediately see, that the observed data exceeds the axis. This example has two little tilted parallel slashes at the end of the x-axis. This is what I would like to achieve on a ggplot plot.
require(plotrix)
x <- rbeta(10000, 1, 7)
hist(x, xlim=c(0,0.4))
axis.break(1,0.405)
Is there a possibility to get similar axis break marks with ggplot? I had the idea to work with geom_segment but I did not achieve any good solution, since it always depends on the ratio of the x and y axis values.
ggplot()+
geom_histogram(aes(x=x), binwidth = 0.05)+
coord_cartesian(xlim = c(0, 0.45))
Thanks for your help!