I am using ggplot to draw faceted maps and have been unable to work out how to allow "free" scales in each facet (so that small regions don't look too small) while keeping the x-y aspect ratio fixed.
Here is a simplified example:
require(maps)
require(ggplot2)
map_nz <- subset(fortify(map_data('nz')),
region %in% c("South.Island ", "North.Island "))
gg_nz <- qplot(long, lat, data=map_nz, geom="polygon", group=group)
I now have a plot of the North and South Islands of New Zealand. I can facet this and display it with a fixed aspect ratio like this:
gg_nz + coord_fixed() + facet_wrap(~region)
with a result that looks like this:
Notice that there is quite a bit of space wasted in the North Island facet. I would like it to take up more of the available space. I can free up the scales like this:
gg_nz + facet_wrap(~region, scales="free")
with the following result:
The problem is that the x-y aspect ratio is no longer 1:1 in each facet. I am happy to have each facet on a different scale, but within the facet I would like to preserve the aspect ratio.
I tried the following without success:
gg_nz + facet_wrap(~region, scales="free") + coord_fixed()
Presumably the scale
parameter in facet_wrap
overrides coord_fixed
. Any suggestions?
UPDATE: to give a more dramatic illustration, here is the same phenomenon with some US states:
Fixed coords (using coord_fixed
or coord_equal
):
Free coords (using scales = free
):
Neither of these maps is ideal: in the first, Delaware is tiny. In the second, the aspect ratios are quite distorted. New Jersey, which is a narrow state, is stretched too wide, for example.