The help page of geom_raster() in 0.9.0 starts out with the following:
"This is a special case of geom_tile where all tiles are the same
size. It is implemented highly efficiently using the internal
rasterGrob function."
Implicit in this statement is that the input data to the geom is a
data frame. From what little I know about the raster package, it
generates its own classes of objects, so it's possible that you need
to convert objects from the raster package into a different format
that ggplot2 will accept.
You might find the rasterVis package useful; by poking around a
little, I discovered a function gplot() which appears to prepare data
objects from the raster package for use in a subsequent ggplot() call.
See the examples section of its help page for a couple of
illustrations. Another possibility is the ggmap package developed by
David Kahle, which has more options for adding maps as background
layers in a ggplot. Like ggplot2, ggmap is in active development.
If you want to plot a raster image in a ggplot, look into
annotation_raster() or annotation_custom(). Section 4 of the
transition guide shows a couple of examples where images were added to
a graph or used as the plot background. The term 'raster' gets bandied
about a bit loosely these days so I'm easily confused about what the
term means.
When you get a solution, would you be kind enough to share it here?
There are several people on this list who have a strong interest in
using ggplot2 for spatial maps. I have a couple of examples in the
sections on geom_map() and geom_raster() in the transition guide, with
a few more in geom_polygon(), but I'm fully aware that's not even
scratching the surface of the potential applications of ggplot2 with
spatial data.
Dennis
> --
> You received this message because you are subscribed to the ggplot2 mailing
> list.
> Please provide a reproducible example: http://gist.github.com/270442
>
> To post: email ggp...@googlegroups.com
> To unsubscribe: email ggplot2+u...@googlegroups.com
> More options: http://groups.google.com/group/ggplot2