Re: [R] ggplot2::qplot() -- arbitary transformations of coordinate system?
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. In the book, or with apropos(^Trans, ignore = F) Hadley -- http://had.co.nz/ __ R-help@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.
Re: [R] ggplot2::qplot() -- arbitary transformations of coordinate system?
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 Kubovykub...@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 400400Charlottesville, VA 22904-4400 Parcels:Room 102Gilmer Hall McCormick RoadCharlottesville, 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@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.
Re: [R] ggplot2::qplot() -- arbitary transformations of coordinate system?
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 Kubovykub...@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 Kubovykub...@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@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@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.
Re: [R] ggplot2::qplot() -- arbitary transformations of coordinate system?
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 Kubovykub...@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 Kubovykub...@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 400400Charlottesville, VA 22904-4400 Parcels:Room 102Gilmer Hall McCormick RoadCharlottesville, 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@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@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 __ R-help@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.
[R] ggplot2::qplot() -- arbitary transformations of coordinate system?
Hi, Does anyone know how to do a coord_trans() in which the y-axis is tranformed into (for example) -1000/y? Thanks, _ Professor Michael Kubovy University of Virginia Department of Psychology USPS: P.O.Box 400400Charlottesville, VA 22904-4400 Parcels:Room 102Gilmer Hall McCormick RoadCharlottesville, 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@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.
Re: [R] ggplot2::qplot() -- arbitary transformations of coordinate system?
why not transform the y-data? On Sat, Sep 5, 2009 at 8:03 PM, Michael Kubovykub...@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? Thanks, _ 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@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. -- Stephen Sefick Let's not spend our time and resources thinking about things that are so little or so large that all they really do for us is puff us up and make us feel like gods. We are mammals, and have not exhausted the annoying little problems of being mammals. -K. Mullis __ R-help@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.