[R] gap.plot fails to plot tick labels on y-axis
Jim Lemon
drjimlemon at gmail.com
Wed Jan 20 01:14:55 CET 2016
Hi Ludo,
The good news is that it was easy. The bad news is that it was my fault. I
hadn't tried labeling the axes with something other than numbers. At about
line 109 in the source code, this line:
show.labels<-c(ytics[littletics],yticlab[bigtics])
should read:
show.labels<-c(yticlab[littletics],yticlab[bigtics])
Attached is the code that you can "source" after loading plotrix and the
fix will be in the next version. Thanks.
Jim
On Tue, Jan 19, 2016 at 11:50 PM, Ludo Pagie <ludo.pagie at gmail.com> wrote:
> 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