[R] ggplot aspect ratio

hadley wickham h.wickham at gmail.com
Wed Jun 6 07:12:00 CEST 2007


Hi Ross,

In brief, you can use ggopt(aspect.ratio = 1) or p$aspect.ratio <- 1
to set the aspect ratio for all plots, or for a single plot
respectively.  There are a few example of this at
http://had.co.nz/ggplot2/coord_equal.html

I am also preparing a chapter for the ggplot book which will discuss
this, as well as more general details of customising absolutely every
aspect of ggplot2 with grid.  I hope to have this out by the end of
the week - I'll probably send another anouncement to R packages when
this is ready.

You should be able to start using ggplot2 with very little effort,
especially if you have been using qplot a lot.

Hadley

On 6/5/07, Ross Boylan <ross at biostat.ucsf.edu> wrote:
> Is there a way to control the aspect ratio of plots using ggplot?
> Specifically, I'm using the formula=a~b argument to produce a grid of
> plots, but the overall width of the result seems to vary for reasons
> that are obscure to me.
>
> This affects not only the appearance of the plots but the amount of
> space available for the title (which seems to be right justified
> relative to the right edge of the grid).
>
> I've tried tweaking some parameters in the past, but they had no effect
> that I could tell.
>
> Perhaps related to that, my previous attempts to use abline to produce a
> 45 degree angle always produced a flat straight line.
>
> There are also a bunch of other tweaks I want to make to get output
> presentation ready.  Is it time to try ggplot2?  I found I could get
> results very quickly with ggplot, but am not sure how much control it
> gives me over the finer details.
>
> Thanks.
> --
> Ross Boylan                                      wk:  (415) 514-8146
> 185 Berry St #5700                               ross at biostat.ucsf.edu
> Dept of Epidemiology and Biostatistics           fax: (415) 514-8150
> University of California, San Francisco
> San Francisco, CA 94107-1739                     hm:  (415) 550-1062
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list