[R] 3 levelplots and 1 colorbar

Joaquin Rapela rapela at usc.edu
Thu Mar 25 20:16:47 CET 2010


I want to create a simple plot containing three levelplots with one colorbar.
I used the "Three levelplots" code below, but the third levelplot is drawn
smaller than the first two. However, if I try the "Two levelplots" code below
it works well. Can anybody tell me how could I draw three levelplots (of the
same size) with one colorbar.

Thanks in advance, Joaquin

### Three levelplots ###
frame <- matrix(rnorm(16*48), nrow=16)

p <-levelplot(frame, colorkey=FALSE)
print(p, position=c(0,0,1/3,1), more=TRUE)
p <-levelplot(frame, colorkey=FALSE)
print(p, position=c(1/3,0,2/3,1), more=TRUE)
p <-levelplot(frame, colorkey=TRUE)
print(p, position=c(2/3,0,3/3,1), more=FALSE)

### Two levelplots ###

frame <- matrix(rnorm(16*48), nrow=16)

p <-levelplot(frame, colorkey=FALSE)
plot(p, position=c(0,0,1/2,1), more=TRUE)
p <-levelplot(frame, colorkey=TRUE)
plot(p, position=c(1/2,0,1,1), more=FALSE)

-- 
Joaquin Rapela
PhD Student, Electrical Engineering
University of Southern California
3641 Watt Way,
Los Angeles, CA 90089-2520
tel/fax: (213) 821-2070
http://www-scf.usc.edu/~rapela
----------------------------------

                       Player King: And hitherto doth love on fortune tend:
                                    For who not needs shall never lack a friend,
                                    And who in want a hollow friend doth try
                                    Directly seasons him his enemy.

                                                                Hamlet
                                                                W. Shakespeare



More information about the R-help mailing list