[R-sig-Geo] bubble vs plot.map -- gstat, maptools

Edzer J. Pebesma e.pebesma at geo.uu.nl
Mon May 15 10:25:29 CEST 2006


Yes, thoughts. It looks like you now get the legend values out of
the graphics file produced by the bubble() command. Bubble has
a key.entries argument, which uses by default:
   key.entries = quantile(data[,zcol])
i.e. the 5 default quantiles (min, q25, med, q75, max).

You may want to provide more sensible values there.
--
Edzer

Zev Ross wrote:
> Hi Roger,
>
> Wow, thanks again for the quick turnaround. Any suggestions in your 
> code in how to get the legend scaled properly to match the "kludgy" 
> scaling of the symbols?
>
> The code below looks pretty good 
> (http://www.zevross.com/temp/test.pdf), but the legend scaling is not 
> really appropriate. Thoughts?
>
> Zev
>
>
> par(pty="s")
> map.nyc<-read.shape("D:/junk/all_counties.shp", dbf.data=T)
> out<-bubble(kcv.wint, "residual", do.sqrt=T, col=c(3,2), main="C.V. 
> Residuals")
> plot(map.nyc, axes=T)
>
>
>  symbols(out$panel.args[[1]], circles=out$panel.args.common$cex*2000,
>   bg=out$panel.args.common$col, inches=F, add=TRUE)
>
>  
>  legend(650000, 4470000, legend=out$legend$right$args$key$text[[1]],
>      pt.cex=out$legend$right$args$key$points$cex, pch=16,
>      col=out$legend$right$args$key$points$col,bty="n", y.intersp=1
>      )
>     
>
>
> Roger Bivand wrote:
>> On Thu, 11 May 2006, Zev Ross wrote:
>>
>>   
>>> Hi All,
>>>
>>> I've got another question for the group. I'm using the bubble function in
>>> GSTAT to plot the residuals from a krige.cv object. I'd like to place on
>>> top the outlines of my counties of interest (or even better I'd like to
>>> plot them in the reverse order). What I'm finding is that even if I
>>> eliminate the key and eliminate the "asp" call from the bubble function,
>>> my two plots don't align as they do under more traditional plotting
>>> circumstances
>>>
>>> Here's the idea:
>>>
>>> kcv28<-krige.cv(avg.pm25~1,pm.all28, vFitRaw, nmax=dim(pm.all28)[1],
>>>      nfold=dim(pm.all28)[1])
>>> bubble(kcv28, "residual", do.sqrt=F)
>>> map.nyc<-read.shape("D:/junk/counties/all_counties.shp", dbf.data=T)
>>> plot(map.nyc, add=T, fg="transparent", ol="gray50")
>>>     
>>
>> Well, bubble() uses lattice graphics, and the plot() methods are most 
>> often base graphics:
>>
>> library(maptools)
>> xx <- readShapePoly(system.file("shapes/sids.shp", package="maptools")[1])
>> xx$crude <- (1000*xx$SID74)/xx$BIR74
>> out <- bubble(pts, "crude")
>> plot(xx, axes=TRUE)
>> symbols(out$panel.args[[1]], circles=out$panel.args.common$cex/10, 
>>   bg=out$panel.args.common$col, inches=FALSE, add=TRUE)
>>
>> is pretty close (with a kludgy cex/10 size factor), or
>>
>> plot(xx, axes=TRUE)
>> points(out$panel.args[[1]], cex=out$panel.args.common$cex, 
>>   col=out$panel.args.common$col, pch=out$panel.args.common$pch)
>>
>> using points(). See
>>
>> str(out)
>>
>> to pick out the guts of the bubble lattice plot object. The plot() 
>> method used here, symbols() and points() are all in base grahics.
>>
>> Also see a recent paper in JSS by Susumu Tanimura, Chusi Kuroiwa, and 
>> Tsutomu Mizota, including some legend code:
>>
>> http://www.jstatsoft.org/
>>
>> Volume 15, 2006, Issue 5 
>>
>> Roger
>>
>>   
>>> Any suggestions? Zev
>>>
>>> --
>>> Zev Ross
>>> ZevRoss Spatial Analysis
>>> 303 Fairmount Ave
>>> Ithaca, NY 14850
>>> (607) 277-0004 (phone)
>>> (866) 877-3690 (fax toll-free)
>>> zev at zevross.com
>>> www.zevross.com
>>>
>>>
>>>     
>>
>>   
>
> -- 
> Zev Ross
> *ZevRoss Spatial Analysis*
> 303 Fairmount Ave
> Ithaca, NY 14850
> (607) 277-0004 (phone)
> (866) 877-3690 (fax toll-free)
> zev at zevross.com
> www.zevross.com
> ------------------------------------------------------------------------
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>




More information about the R-sig-Geo mailing list