Description Usage Arguments Details Value See Also Examples
Safely reshape 'long' data.frame to 'wide' format suitable for 'persp', 'image', 'contour', 'filled.contour', 'heatmap', etc.
1 |
data |
data.frame of 3 columns, of which first two are x,y locations and third column is z values |
... |
further arguments passed to other methods |
Solves the dreaded "Error: increasing 'x' and 'y' values expected".
List with components x$x and x$y for x and y axes, and x$z is a matrix containing the values to be plotted
1 2 3 4 5 6 7 8 9 10 | set.seed(23)
d <- expand.grid(lon=seq(-125.5, -110.0, by=0.2),
lat=seq(40.5, 49.5, by=0.2))
d$z <- rnorm(nrow(d), 30, .2) * d$lat * d$lon
res <- reshape_w(d)
image(res)
contour(res, add=TRUE, lwd=2, nlevels=12)
persp(res, theta=0, phi=45)
filled.contour(res, color.palette=heat.colors)
heatmap(res$z)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.