r - how to break x-axis in a density plot -
i want plot distribution , single value (with abline) smaller minimum value in distribution, abline won't appear in plot. how can plot them in same plot manipulating x-axis scale or maybe inserting breaks?
data <- rnorm(1000, -3500, 27) estimate <- -80000 plot(density(data)) abline(v = estimate)
here's rough solution, it's not particularly pretty:
library(plotrix) d <- density(data) gap.plot(c(-8000,d$x), c(0,d$y), gap=range(c(-7990,-3620)), gap.axis="x", type="l", xlab="x", ylab="density", xtics=c(-8000,seq(-3600,-3300,by=100))) abline(v=-8000, col="red", lwd=2)
Comments
Post a Comment