Import library and produce data.
library(plotrix)
x <- c(1:5, 6.9, 7)
y <- 2^x
Define up and low boundary of the gapped region of Y axis.
from <- 33
to <- 110
Produce a normal dot plot.
plot(x, y, type="b", xlab="index", ylab="value")
Produce a dot plot with gapped Y axis.
gap.plot(x, y, gap=c(from,to), type="b", xlab="index", ylab="value")
axis.break(2, from, breakcol="snow", style="gap")
axis.break(2, from*(1+0.02), breakcol="black", style="slash")
axis.break(4, from*(1+0.02), breakcol="black", style="slash")
axis(2, at=from)
Produce a bar plot with gapped Y axis.
gap.barplot(y, gap=c(from,to), col=as.numeric(x),
xlab="index", ylab="value")
axis.break(2, from, breakcol="snow", style="gap")
axis.break(2, from*(1+0.02), breakcol="black", style="slash")
axis.break(4, from*(1+0.02), breakcol="black", style="slash")
axis(2, at=from)
Produce a horizontal bar plot with gapped Y axis.
gap.barplot(y, gap=c(from,to), col=as.numeric(x),
horiz=T, xlab="index", ylab="value")
axis.break(1, from, breakcol="snow", style="gap")
axis.break(1, from*(1+0.02), breakcol="black", style="slash")
axis.break(3, from*(1+0.02), breakcol="black", style="slash")
axis(1, at=from)