So far I have only used ggplot2 for producing facetted plots. I am
plotting various collections of datasets in various plots. This means
that my plots sometimes have (say) 2x3 facets, sometimes 4x3 and so.
In my case, the content of each facet is the same, so I have identical
x- and y-axis. But since ggplot2 does the standard R thing of
expanding to fill the device, the aspect ratio of the facets on
different plots are different, something that works havoc on any plot-
to-plot comparison.
In standard R I would usually fix this by changing the device size, say
par(mfrow = c(1,1))
quartz(width = 7, height = 7)
par(mfrow = c(1,2))
quartz(width = 14, height = 7)
But in ggplot2 I have two areas, essentially the legend area and also
the axis area to the left side of the plot. This means that if I have
2 columns of facets, I cannot just do facet_width = device_width / 2
What I would really like is - for a given plot - to tell me how big a
single facet is in width and height in % of the device area. This
should be possible based on my knowledge of grid. At least in the
little grid plotting I have done, I have usually specified sizes in %
of device area, so I am just asking for the right way to interrogate
the ggplot2 structure to get the settings of the facet.
The wishlist function is a function that given a height and a width of
a facet, computes how big the device needs to be in order to get the
given facet height, width. That seems to be very useful for facetted
plotting.
Thanks
Kasper
The width of that grob is defined in terms of another grob, but you
should be able to force grid to tell you the physical measurement with
convertWidth. I've emailed Paul to see why it's not working in this
instance.
Hadley