[R-sig-Geo] spplot : varying dots for multiple parameters

Servet Ahmet Cizmeli sa.cizmeli at usherbrooke.ca
Mon Dec 14 17:40:37 CET 2009

Dear Roger, Edzer,

Thanks a lot for your kindly help. I just switched to R from Matlab
after 12 years of Matlab experience. It is actually an agonizing
experience as R is indeed very different than Matlab. There are so many
different ways to perform one given task that I am completely at loss
right now. But I am not giving up ;o)

I just run the command install.packages("sp") which reinstalled the
latest version : sp_0.9-51.tar.gz. The Warning messages described in my
first message are still there, though. The output of sessionInfo() is
given at the end of the message for your convenience.

Thanks a lot Roger for your code. It indeed improves my graphs a lot. 

I have some other questions if you don't mind :

Question 1 : Wouldn't it help if the bubble function supported the
convenient rm.na option? 

Question 2 : Each bubble() plot is widely spaced one from the other.
There is a lot of waste of space. How can I adjust the margins so that
the maps are tightly placed just like in lattice? The bHEX object
returned by bubble() is of class "lattice" and I don't seem to find any
information explaining how to perform such a fine-tuning. I would
appreciate any guidance that would point me to the place where all this
is explained. I don't presently seem to look at the right place. 

There is also the 3rd plot box which is of different size than the rest in
Roger's code... 
How to make all the boxes aligned and of exactly the same size?

On Mon, 2009-12-14 at 08:02 +0100, Edzer Pebesma wrote: 
> I don't think spplot allows this; you'd have to use lattice' function
> xyplot, to which spplot (for points) is a rather thin wrapper.

Yes, I would like to learn better "lattice" tools as they seem to be very
That is why I was experimenting with spplot :

> xyplot(Insitu_sp[!idx,])
Error in UseMethod("xyplot") : 
no applicable method for 'xyplot' applied to an object of class

Question 3 :
How to tell xyplot to create maps of georeferenced "sp" objects? There is
no mention of 
this in the help page of xyplot?

I would like to plot a legend by using the following code :

dataset = c("SPM","CHL_A")
for (AA in 1:length(dataset)) {

idx = as.logical(is.na(Insitu[dataset[AA]]))

tmp <- bubble(Insitu_sp[!idx,], dataset[AA], xlim=xlim, ylim=ylim,
sp.layout = my.layout, key.space=list(x=0.1,y=.95,corner=c(0,1)))
plot(tmp, split=c(1,AA,1,2), more=TRUE)

but no legend is drawn and the following warning is being displayed twice :
Warning messages:
1: In names(legend)[1] <- space :
number of items to replace is not a multiple of replacement length

Question 4 : 
How can I place a legend at a custom place?


Output of sessionInfo()
R version 2.10.0 (2009-10-26) 

[1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
[3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
[5] LC_MONETARY=C              LC_MESSAGES=en_US.UTF-8   
[7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
[9] LC_ADDRESS=C               LC_TELEPHONE=C            

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] rgdal_0.6-23 sp_0.9-51   

loaded via a namespace (and not attached):
[1] grid_2.10.0     lattice_0.17-26 tools_2.10.0

More information about the R-sig-Geo mailing list