[R] Label positions for the legend when using smallplot within image.plot

Alberte Bondeau (PIK) Alberte.Bondeau at pik-potsdam.de
Wed Nov 17 23:04:40 CET 2010


Hi all,

after having many images plots on my window, I want to have one single 
legend plot.

For that I use image.plot where the position is defined within smallplot:

      image.plot(legend.only=T,zlim=c(0,400), 
col=rainbow(50),horizontal=T,smallplot=c(.05,.45, .03,.06))

This works fine, but I found that the labels of the x axis are too much 
far away from the axis.
Therefore I wanted to use

    par(mgp=c(0, 0.5, 0))

in order to write the labels closer to the axis.
It worked only when I specified, within image.plot
    legend.args=list(axis(side=1))

so:

      image.plot(legend.only=T,zlim=c(0,400), 
col=rainbow(50),horizontal=T,smallplot=c(.05,.45, 
.03,.06),legend.args=list(axis(side=1)))

However, strangely I now have the labels twice: where I want to have 
them, OK, but they also appear at their old places, where I do not want 
to have them. I tried many ways of suppressing the labels that I do not 
want, also by using
axis.args=list(xlab="")
but it seemed that are "hard" connected to this smallplot

Does anyone already encounter such a problem?

Many thanks,

alb



More information about the R-help mailing list