This question has been converted to Community Wiki and wiki locked
because it is an example of a question that seeks a list of answers
and appears to be popular enough to protect it from closure. It
should be treated as a special case and should not be viewed as the
type of question that is encouraged on this, or any Stack Exchange
site, but if you wish to contribute more content to it then feel free
to do so by editing this answer.
This is not so much a trick as it is
spplot()'s nifty built-in functionality.
spplot()’s ability to scale legend swatches (to match classification break ranges) serves as a useful pedagogical tool when discussing attribute data distribution and classification types. Combining cumulative distribution plots with the maps helps in this endeavor.
The students only need to modify a few script parameters to explore classification types and data transformation effects. This is usually their first foray into R in what is a mostly ArcGIS centric course.
Here's a code snippet:
library(rgdal) # Loads SP package by default
NE = readOGR(".", "NewEngland") # Creates a SpatialPolygonsDataFrame class (sp)
pal = brewer.pal(7,"Greens")
brks.qt = classIntervals(NE$Frac_Bach, n = 7, style = "quantile")
brks.jk = classIntervals(NE$Frac_Bach, n = 7, style = "jenks")
brks.eq = classIntervals(NE$Frac_Bach, n = 7, style = "equal")
# Example of one of the map plots
spplot(NE, "Frac_Bach",at=brks.eq$brks,col.regions=pal, col="transparent",
main = list(label="Equal breaks"))
# Example of one of the cumulative dist plots
Ref: Applied Spatial Data Analysis with R (R. Bivand, E Pebesma & V. Gomez-Rubio)