[GRASS-stats] Scatterplot "thinning" (points reduction)?

Dylan Beaudette debeaudette at ucdavis.edu
Mon Aug 17 12:55:23 EDT 2009


On Monday 17 August 2009, Markus Neteler wrote:
> On Mon, Aug 17, 2009 at 9:33 AM, Roger Bivand<Roger.Bivand at nhh.no> wrote:
> > On Sun, 16 Aug 2009, Markus Neteler wrote:
> >> Hi,
> >>
> >> I am plotting elevation against temperature and have the problem that
> >> including all points leads to heavy slow graphs... Reducing the raster
> >> resolution is not a solution since it does not maintain the
> >> characteristics
> >> of the graph (since GRASS is using nearest neighbor).
> >
> > One point initially. I'm assuming that you are using a Linux platform -
> > on this platform, there is an order of magnitude speedup if you plot on
> > screen without "cairo", the default x11 type= - try using type="Xlib",
> > which is much faster but not so refined.
>
> (yes, Linux)
> I have searched around bit I am not entirely sure to which function
> this type parameter belongs.
>
> > Given that, consider the cex= argument for varying symbol size, and maybe
> > the pch="." possibility for using a single pt. point. They still all get
> > drawn, so there is no time saving, but they may be more visible.
>
> I am currently plotting like this:
> plot(data$dem ~ data$raw)
> points(data$dem ~ data$filt2, col="yellow", cex=0.5, pch=3)
> points(data$dem ~ data$rst, col="green", xlab="LST value [°C]",
> ylab="elevation [m]", pch=2)
> abline(lm(data$dem ~ data$raw))
> abline(lm(data$dem ~ data$filt2), col="yellow")
> abline(lm(data$dem ~ data$rst), col="green", xlab="LST value [°C]",
> ylab="elevation [m]")

just a quick note on style:

# simpler notation:
plot(dem ~ raw, data=data, xlab="LST value [°C]", ylab="elevation [m]")
points(dem ~ filt2, data=data, col="yellow", cex=0.5, pch=3)
points(dem ~ rst, data=data, col="green", pch=2)


also note that 'xlab' and other related commands need to be put into a  
high-level plotting command like 'plot()'

finally, you might be able to make the plot in one command with some 
incantation of xyplot() from the lattice package. 

did you have a chance to try the kde2() function from MASS?

Cheers, 
Dylan



> So the backgound (largest) cloud comes in back circles,
> the interim (smaller) in yellow crosses with many of them in the circles,
> and the upper point could (smallest) in green triangles.
> I guess the real problem are the 826896 * 3 points in the plot.
>
> > For very large data sets, consider hexbin() in the hexbin package - I'm
> > not sure how best to display three data sets. For single scatterplots, it
> > is very powerful. Maybe contours of 2D densities of the extra data sets
> > could be overlaid over a base hexbin plot? There is an informative
> > vignette in hexbin.
>
> Oh, this is interesting! Thanks,
> Markus
> _______________________________________________
> grass-stats mailing list
> grass-stats at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-stats



-- 
Dylan Beaudette
Soil Resource Laboratory
http://casoilresource.lawr.ucdavis.edu/
University of California at Davis
530.754.7341


More information about the grass-stats mailing list