Skip to content
Prev 308372 / 398506 Next

svyplot and svysmooth with hexbin

Hi
On 19/10/2012 6:49 a.m., Durant, James T. (ATSDR/DCHI/SSB) wrote:
There may be a higher-level interface to do this, but here's a 
nuts-and-bolts solution to do what I think you want ...

# Save the result from svyplot() call.
temp <- svyplot(api00~api99, dclus2, style="grayhex")

# Part of the result is the viewport that svyplot()
# used to draw the plot (technically its a hexViewport).
# Push that hexViewport so we can draw in the original
# plot region and scales.
pushHexport(temp$plot.vp)

# Use grid.lines() to draw the smoother relative to the
# "native" scales in the plot hexViewport.
lapply(s1, function(z) { grid.lines(z$x, z$y, default="native") })

Hope that helps

Paul