Re: [R] How to access the attributes of a ggplot?

From: Tribo Laboy <tribolaboy_at_gmail.com>
Date: Tue, 08 Apr 2008 19:02:18 +0900

Hi Hadley,

Thanks for replying. I know that I can directly modify some of the properties of the plot object, but I was more interested in querying the current plot properties, something like:

xlimits <- getggopts(pobj, "x_scale_limits")

Is there anything like this implemented?

I tried to drill down the structure of the plot object using grid, but wasn't very successful... It gets a bit complicated, so I decided to ask if you have implemented something like that above...

On Tue, Apr 8, 2008 at 5:04 AM, hadley wickham <h.wickham_at_gmail.com> wrote:
> Hi Tribo,
>
>
> > I found 'ggopts', but it only returns some of the properties. Say I
> > want to get the x- and y-axis limits, the tickmark locations, legend
> > current position, the legend box and background color and set them to
> > new values.
> >
> > Are these properties easily accessible (and modifiable) from the object?
>
> Some of them are:
>
> * the x and y axis limits are properties of the scales (e.g. +
> scale_x_continuous(limits=c(5, 10))
> * the tickmark locations and labels are also properties of the scales
> (e.g. + scale_x_continuous(breaks=c(5, 10), labels=c("five","ten"))
> * the legend position is set by ggopt()
>
> Some of them aren't:
>
> * legend fill and outline colours can only be changed by modifying
> the underlying grid object - see the last chapter of the ggplot book
> to see how to do this.
>
> Hadley
>
>
> --
> http://had.co.nz/
>



R-help_at_r-project.org 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. Received on Tue 08 Apr 2008 - 10:05:51 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 08 Apr 2008 - 14:30:31 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive