[R] ggplot2: How to export several plots with same width?

Zeljko Vrba zvrba at ifi.uio.no
Mon Jun 1 08:19:44 CEST 2009


I have three plots and I want the *plot area* to be of the same width on
each plot.  Since the three plots have different legends, the text width
of the legend affects the width of the plot area (longer legend text =
narrower plot area).  Exporting the three figures to postscript device
of same size gives thus unequal plot areas.  How can I calculate the
correct width of postscript device for each figure, so that plot areas
will be equally wide?

Is there a better alternative?

(I tried to place the legend inside the plot area, which kinda works, but
the problem is that legend.position is relative to the *device*, not to
the *plot area*, so I don' know how to align the legend with plot border.)




More information about the R-help mailing list