I want to produce gap.barplot with stack (for example like this: https://www.eclipse.org/forums/index.php/t/487795/). But, i could not figure out how. Or, is there a way to do y-axis break in a histogram?
this is the my data:
dt <- structure(c(1162L, 699L, 20L, 26L, 2L, 4L, 1L, 11L, 2L, 8L, 5L,
15L, 2L, 23L, 3L, 25L, 3L, 30L, 0L, 24L, 0L, 23L, 1L, 14L, 0L,
4L, 1L, 1L, 0L, 2L, 0L, 0L, 0L, 1L, 0L, 1L, 0L, 0L, 0L, 1L, 0L,
0L), .Dim = c(2L, 21L), .Dimnames = structure(list(c("FALSE",
"TRUE"), c("0", "2", "4", "6", "8", "10", "12", "14", "16", "18",
"20", "22", "24", "26", "28", "30", "32", "34", "36", "38", "40"
)), .Names = c("", "")), class = "table")
I tried with package "plotrix", like below without success.
library(plotrix)
# specifying the gap!
from <- 50
to <- 1830
# x axis
n1 <-seq(-1, 41, by=2)
n2 <- seq(0, 40, 2)
# actual plotting, but it does not work!
gap.barplot(dt, gap = c(from, to), xlab = "index", ylab = "number of points",
ytics=c(10, 20, 30, 40, 1810, 1840, 1860), xaxlab = n2, col=c("darkblue","red"),
legend = rownames(dt))