[R] gap.plot fails to plot tick labels on y-axis

Ludo Pagie ludo.pagie at gmail.com
Tue Jan 19 13:50:20 CET 2016


Dear all,

I'm using gap.plot(..) (plotrix-3-5-11) to make a plot containing a
broken axis. It seems in some cases that gap.plot() does not plot the
proper tick labels at the y-axis. Case in question is when I specify
tick labels for all ticks, on both y-ranges (ones below and one above
the gap). When the gap is on the x-axis it works correctly.

Example code:

##############
# gap on y-axis with tick labels specified
gap.plot(x=1:7, y=c(1:3, 10:13), gap.axis='y', gap=c(4.5,9.5),
xlim=c(1,7), ylim=c(1, 13), ytics=1:13, yticlab=letters[1:13])

# same on x-axis; this works ok
gap.plot(y=1:7, x=c(1:3, 10:13), gap.axis='x', gap=c(4.5,9.5),
ylim=c(1,7), xlim=c(1, 13), xtics=1:13, xticlab=letters[1:13])


sessionInfo()
R version 3.2.1 (2015-06-18)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.1 LTS

locale:
[1] C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] plotrix_3.5-11

###############

The function gap.plot contains a specification of tick labels. The
case corresponding to the error:
show.labels <- c(ytics[littletics], yticlab[bigtics])

Other (correct?) cases use this:
show.labels <- c(yticlab[littletics], yticlab[middletics],yticlab[bigtics])
show.labels <- c(xticlab[littletics], xticlab[bigtics])
show.labels <- c(xticlab[littletics], xticlab[middletics],xticlab[bigtics])

I think the 1st case uses the 'ytics' instead of 'yticlab'. Or can
somebody point out what I do wrong?

cheers, Ludo



More information about the R-help mailing list