[R] ggplot2::qplot() -- arbitary transformations of coordinate system?

David Winsemius dwinsemius at comcast.net
Sun Sep 6 16:46:59 CEST 2009


Is there a place to find a list of the legal values for the  
coord_trans parameters. I spent a bunch of time searching the ggplot2  
docs and r-help for same without success. I also made an attempt at  
looking at the code in R which also failed.

-- 
David.

On Sep 6, 2009, at 10:12 AM, hadley wickham wrote:

> Hi Michael,
>
> You could use aes(y = 1000 * myyvar) and coord_trans(trans_y =  
> "inverse")
>
> Hadley
>
> On Sun, Sep 6, 2009 at 6:30 AM, Michael Kubovy<kubovy at virginia.edu>  
> wrote:
>> Hi Stephen,
>>
>> Because coord_trans() does all the work of plotting the original  
>> values on
>> the tranformed scale. See ?coord_trans. To quote: "The difference  
>> between
>> transforming the scales and transforming the coordinate system is  
>> that scale
>> transformation occurs BEFORE statistics, and coordinate  
>> transformation
>> afterwards."
>>
>> # After
>> require(ggplot2)
>> data(diamonds)
>> # Three ways of doing transformating in ggplot:
>> # * by transforming the data
>> qplot(log10(carat), log10(price), data=diamonds)
>> # * by transforming the scales
>> qplot(carat, price, data=diamonds, log="xy")
>> qplot(carat, price, data=diamonds) + scale_x_log10() +  
>> scale_y_log10()
>> # * by transforming the coordinate system:
>> qplot(carat, price, data=diamonds) + coord_trans(x = "log10", y =  
>> "log10")
>>
>> Michael
>>
>> On Sep 5, 2009, at 9:01 PM, stephen sefick wrote:
>>
>>> why not transform the y-data?
>>>
>>> On Sat, Sep 5, 2009 at 8:03 PM, Michael  
>>> Kubovy<kubovy at virginia.edu> wrote:
>>>>
>>>> Hi,
>>>>
>>>> Does anyone know how to do a coord_trans() in which the y-axis is
>>>> tranformed
>>>> into (for example) -1000/y?
>>
>>> Stephen Sefick
>>
>>
>>
>> _____________________________
>> Professor Michael Kubovy
>> University of Virginia
>> Department of Psychology
>> USPS:     P.O.Box 400400    Charlottesville, VA 22904-4400
>> Parcels:    Room 102        Gilmer Hall
>>      McCormick Road    Charlottesville, VA 22903
>> Office:    B011    +1-434-982-4729
>> Lab:        B019    +1-434-982-4751
>> Fax:        +1-434-982-4766
>> WWW:    http://www.people.virginia.edu/~mk9y/
>>
>> ______________________________________________
>> 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.
>>
>
>
>
> -- 
> 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.

David Winsemius, MD
Heritage Laboratories
West Hartford, CT




More information about the R-help mailing list