[R-sig-Geo] spplot with legend only, and legend inside the plotting area

Mauricio Zambrano-Bigiarini hzambran.newsgroups at gmail.com
Wed Mar 7 23:30:18 CET 2012


2012/3/7 Oscar Perpiñán Lamigueiro <oscar.perpinan at upm.es>:
> Mauricio Zambrano-Bigiarini <mauricio.zambrano at jrc.ec.europa.eu> writes:
>
>> On 07/03/12 13:11, Oscar Perpiñán Lamigueiro wrote:
>>> Mauricio Zambrano-Bigiarini<mauricio.zambrano at jrc.ec.europa.eu>  writes:
>>>
>> The real problem appears when I try to produce several spplots within
>> the same figure (each one of them for a different spatial area), with
>> a unique legend for all the figures (that is the reason why I can not
>> use 'legend' command).
>
> Then you could use c.trellis:
>
> With your example:
>
> c(dummy, dummy, dummy, dummy).
>
> Inside c() you can define the 'layout' and decide if you want to merge
> legends with 'merge.legends'.
>
> Oscar.

Thanks Oscar.

i followed the examples in c.trellis, but it doesn't work:

library(sp)
xyz = data.frame(expand.grid(x=1:10,y=1:10),rnorm(100))
coordinates(xyz)=~x+y

# only to get the default values from 'auto.key'
dummy <- spplot(xyz, cex=10, alpha=0.7)

# checking that 'dummy' is a trellis
class(dummy)

library(lattice)
cObj <- c(dummy, dummy)
update(cObj)

Error en eval(expr, envir, enclos) :
  '...' usado en un contexto incorrecto # EN: '...' used in an invalid context

Also, in the documentation of c.trellis, it is mentioned that "Many
properties of the display, such as titles, axis settings and aspect
ratio will be taken from the first object only.", so if the spatial
extent of the figures are different, 'c.trellis' shouldn't do the
work, right ?

Thanks again,

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
=======================================================
"There is only one pretty child in the world, and every mother has it."
(Chinese Proverb)
=======================================================
http://c2.com/cgi/wiki?HowToAskQuestionsTheSmartWay



More information about the R-sig-Geo mailing list