<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Very helpful! Thanks. The code for points I attached here does have the
border so that some points can be distinguished. But you're right it
would be better to plot the smaller circles first. I'm not going to
spend the time on that now -- I've already spent enough (too much?)
time on this piece. Instead, I've produced zoom in plots. I appreciate
your help and if you're interested in seeing what the plot now looks
like (<a class="moz-txt-link-freetext" href="http://www.zevross.com/temp2.html">http://www.zevross.com/temp2.html</a>).<br>
<br>
points(out$panel.args[[1]], cex=out$panel.args.common$cex, <br>
bg=out$panel.args.common$col, pch=21, col="black" )<br>
<br>
Zev<br>
<br>
Roger Bivand wrote:
<blockquote
 cite="midPine.LNX.4.44.0605120859500.17533-100000@reclus.nhh.no"
 type="cite">
  <pre wrap="">On Thu, 11 May 2006, Zev Ross wrote:

  </pre>
  <blockquote type="cite">
    <pre wrap="">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?
    </pre>
  </blockquote>
  <pre wrap=""><!---->


  </pre>
  <blockquote type="cite">
    <pre wrap="">The code below looks pretty good (<a class="moz-txt-link-freetext" href="http://www.zevross.com/temp/test.pdf">http://www.zevross.com/temp/test.pdf</a>),
but the legend scaling is not really appropriate. Thoughts? 
    </pre>
  </blockquote>
  <pre wrap=""><!---->
This is because the symbols(..., inches=FALSE) is plotting in user display 
units, but legend() is plotting in font size units - you'd need to fake a 
legend with symbols(..., inches=FALSE) in user display space to get them 
to match.

When I chose the points() route, the cex in the bubbles and the legend are 
the same (as far as heads-up measuring is accurate). The legend bubbles in 
bubbles() also overlap, but this can be alleviated, as you saw, with 
y.intersp=. My reading of the JSS paper and accompanying function 
ProportionalSymbolMap() is that they use symbols, and work hard on the 
legend. The function needs generalising to take other input objects than 
point type old-style Map objects, but that isn't hard. It does have the 
nice quality of plotting big bubbles before small ones, with a border, so 
that overplotted bubbles are distinguished.

Roger

PS. my code was missing:

pts &lt;- SpatialPointsDataFrame(coordinates(xx), as(xx, "data.frame"))

and my legend is:

legend("bottomleft", legend=out$legend$right$args$key$text[[1]], 
  pt.cex=out$legend$right$args$key$points$cex,
  pch=out$legend$right$args$key$points$pch, 
  col=out$legend$right$args$key$points$col,bty="n", y.intersp=1.2) 

  </pre>
  <blockquote type="cite">
    <pre wrap="">Zev


par(pty="s")
map.nyc&lt;-read.shape("D:/junk/all_counties.shp", dbf.data=T)
out&lt;-bubble(kcv.wint, "residual", do.sqrt=T, col=c(3,2), main="C.V.
Residuals")
plot(map.nyc, axes=T)


&nbsp;symbols(out$panel.args[[1]], circles=out$panel.args.common$cex*2000,
&nbsp; bg=out$panel.args.common$col, inches=F, add=TRUE)

&nbsp;
&nbsp;legend(650000, 4470000, legend=out$legend$right$args$key$text[[1]],
&nbsp;&nbsp;&nbsp;&nbsp; pt.cex=out$legend$right$args$key$points$cex, pch=16,
&nbsp;&nbsp;&nbsp;&nbsp; col=out$legend$right$args$key$points$col,bty="n", y.intersp=1
&nbsp;&nbsp;&nbsp;&nbsp; )
&nbsp;&nbsp;&nbsp;&nbsp;


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&lt;-krige.cv(avg.pm25~1,pm.all28, vFitRaw, nmax=dim(pm.all28)[1],
&nbsp;&nbsp;&nbsp; &nbsp;nfold=dim(pm.all28)[1])
bubble(kcv28, "residual", do.sqrt=F)
map.nyc&lt;-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 &lt;- readShapePoly(system.file("shapes/sids.shp", package="maptools")[1])
xx$crude &lt;- (1000*xx$SID74)/xx$BIR74
out &lt;- 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:

<a class="moz-txt-link-freetext" href="http://www.jstatsoft.org/">http://www.jstatsoft.org/</a>

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)
<a class="moz-txt-link-abbreviated" href="mailto:zev@zevross.com">zev@zevross.com</a>
<a class="moz-txt-link-abbreviated" href="http://www.zevross.com">www.zevross.com</a>


    


--
Zev Ross
ZevRoss Spatial Analysis
303 Fairmount Ave
Ithaca, NY 14850
(607) 277-0004 (phone)
(866) 877-3690 (fax toll-free)
<a class="moz-txt-link-abbreviated" href="mailto:zev@zevross.com">zev@zevross.com</a>
<a class="moz-txt-link-abbreviated" href="http://www.zevross.com">www.zevross.com</a>


    </pre>
  </blockquote>
  <pre wrap=""><!---->
  </pre>
</blockquote>
<br>
<div class="moz-signature">-- <br>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; ">
<font face="Arial, Helvetica, sans-serif, Trebuchet MS" size="-1">Zev
Ross<br>
<strong><font color="#660000">ZevRoss Spatial Analysis</font></strong><br>
303 Fairmount Ave<br>
Ithaca, NY 14850<br>
(607) 277-0004 (phone)<br>
(866) 877-3690 (fax toll-free)<br>
<a class="moz-txt-link-abbreviated" href="mailto:zev@zevross.com">zev@zevross.com</a><br>
<a class="moz-txt-link-abbreviated" href="http://www.zevross.com">www.zevross.com</a></font><br>
</div>
</body>
</html>