[R-sig-Geo] spplot with legend only, and legend inside the plotting area
Mauricio Zambrano-Bigiarini
mauricio.zambrano at jrc.ec.europa.eu
Thu Mar 8 12:10:57 CET 2012
On 08/03/12 09:21, Oscar Perpiñan wrote:
> Sorry: I forgot to say that you need latticeExtrato use c.trellis.Then:
> library(latticeExtra)
> c(dummy, dummy, dummy, dummy).
>
Thanks Oscar !. I didn't realise about 'latticeExtra' instead of lattice...
One last question. By using c(), is it possible to put different axis
labels for each plot ?
-------------- START ----------------
library(sp)
xyz = data.frame(expand.grid(x=1:10,y=1:10),rnorm(100))
coordinates(xyz)=~x+y
# Different spatial extent for the 2nd dummy set
xyz2 = data.frame(expand.grid(x=100:200,y=100:200),rnorm(10201))
coordinates(xyz2)=~x+y
# only to get the default values from 'auto.key'
dummy <- spplot(xyz, cex=2, alpha=0.7, xlab="X1", ylab="Y1",
scales=list(draw=TRUE))
dummy2 <- spplot(xyz2, cex=2, alpha=0.7, xlab="X2", ylab="Y2")
# checking that 'dummy' is a trellis
class(dummy)
library(lattice)
library(latticeExtra)
cObj <- c(dummy, dummy2, dummy, dummy2, layout=c(2,4), merge.legends=FALSE)
update(cObj)
-------------- END ----------------
in the previous figure, xlab and ylab are set the same for all the
plots, even if for two of them they are different ...
Thanks in advance,
Mauricio
--
=======================================================
FLOODS Action
Water Resources Unit (H01)
Institute for Environment and Sustainability (IES)
European Commission, Joint Research Centre (JRC)
webinfo : http://floods.jrc.ec.europa.eu/
=======================================================
DISCLAIMER:
"The views expressed are purely those of the writer
and may not in any circumstances be regarded as stating
an official position of the European Commission."
=======================================================
Linux user #454569 -- Ubuntu user #17469
=======================================================
"If Columbus had turned back, no one would have blamed him.
Of course, no one would have remembered him either."
(Source Unknown)
More information about the R-sig-Geo
mailing list