Hi Jane,

Try this:

split.screen( rbind(c(0, .8,0,1), c(.8,1,0,1)))
# [1] 1 2
# first screen split into a (2, 1) configuration
ind <- split.screen(c(2,1), screen=1)
screen(ind[1])
image(x, y, z, col = cols, zlim = zr)
screen(ind[2])
image(x, y, z2, col = cols, zlim = zr)
# Place the common, complete legend
screen(2)
image.plot( zlim=zr,legend.only=TRUE, smallplot=c(.1,.2, .3,.7), col = cols)

Source: help page of image.plot() in the fields package.

HTH,
Dennis

On Wed, Sep 15, 2010 at 7:05 PM, rusers.sh <rusers...@gmail.com> wrote:

> Hi all,
>  I want to put several figures in a one figure for easy comparison, so i
> need to use the same methods to plot these figures. The following is an
> example. I also list my method, but it does not work.
> #Example data
> x<- 1:10; y<- 1:10; z<- outer( x,y,"+");z2<- outer( x,y,"-")
> #Quick view them
> image.plot(x,y,z)  #relatively larger value
> image.plot(x,y,z2)   #relatively small value
> #define the same breaks and colors
> brks<-quantile(c(as.vector(z),as.vector(z2)),na.rm=TRUE)
> colsn<-length(brks)-1
> cols<-gray((colsn:1)/colsn)
> #I expect they use the same breaks and colors
> par(mfrow=c(1,2))
> image.plot(x,y,z,breaks=brks,col=cols)
> image.plot(x,y,z2,breaks=brks,col=cols)
> par(mfrow=c(1,1))
>  I think they really use the same breaks and colors, but you can see the
> color legends are still different. One is 20-15-10-5, another is 5-0--5.
>  I hope they not only use the same breaks and colors, but also display the
> same color legends. How can i do it?
>  Any suggestions or help are appreciate.
>
> --
> -----------------
> Jane Chang
> Queen's
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to