1

I am creating mapplots in using this code:

ggplot(fl, aes(long, lat, group = group)) +
    geom_polygon(aes(fill = density)) + guides(fill=FALSE) +
    geom_path(colour = "white", size = .1, alpha = .5) +
    scale_x_continuous(name = "", labels = NULL, breaks = NULL) +
    scale_y_continuous(name = "", labels = NULL, breaks = NULL) +
    coord_fixed()

Lat, long, and group are what you'd expect and this produces a map of Florida with counties different shades of blue. When I do this, it generates a PDF that is 6-in square. But the underlying plot is not square and for Maryland, it is really 5x3 or so. How can I force ggplot to create a PDF without excess whitespace surrounding the plot for better inclusion through Sweave?

James Howard
  • 1,258
  • 2
  • 11
  • 26

0 Answers0