[R] lattice: simultaneously control aspect & outer whitespace
Deepayan Sarkar
deepayan.sarkar at gmail.com
Mon Aug 10 05:11:17 CEST 2009
On 8/7/09, Jacob Wegelin <jacob.wegelin at gmail.com> wrote:
> Suppose we wish to achieve the following three aims:
> (1) Control the aspect ratio of our plot (i.e., tweak this till it looks
> great)
>
> (2) Save the plot as a PDF with zero or minimal white space outside it.
>
> (3) Preserve this in code, so that in the future the exact same plot can be
> reproduced by simply sourcing the code.
>
> I can almost achieve (1) and (2) on my MacBook Pro by pointing and clicking,
> as follows:
>
> • Start with graphics.off().
>
> • Generate the plot on the computer screen; then the outer margins are
> pretty thin by default.
>
> • Use the mouse to adjust the aspect ratio until it looks right.
>
> The fact that I pointed and clicked precludes (3).
Once you have resized to a suitable size, use
par("din")
to find the current dimensions, and then use these as 'width' and
'height' arguments to pdf().
-Deepayan
More information about the R-help
mailing list