[R] ggplot, transformation, and ylim

From: godwin yung <godwin.y.yung_at_gmail.com>
Date: Thu, 17 Mar 2011 11:29:52 -0700


Hey everyone,

I'm having a little trouble with ggplot. I have two sets of y-values, one whose range is contained in the other. Due to the nature of the y-values, I wish to scale the y axis with a log base two transformation. Furthermore, I wish to plot the two sets of y-values as boxplots in separate graphs with the same ylim (and thus with the same ticks and tick labels). As of now, I have:
ggplot(data, aes(x1, y1))+geom_boxplot()+scale_y_log2() ggplot(data, aes(x2, y2))+geom_boxplot()+scale_y_log2() which successfully creates the boxplot and transforms the y-axis. However, I can't figure out how to change the range of the y-axis so that they're the same in both graphs. Inserting "+scale_y_continuous(limits=c(...))" before or after "+scale_y_log2()" doesn't seem to work. I also tried: qplot(x1,y1,geom="boxplot", ylim=c(...))+scale_y_log2() but my efforts were in vain. Any ideas?

Thanks.

Cheers,
Godwin

        [[alternative HTML version deleted]]



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 Thu 17 Mar 2011 - 19:57:56 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 Thu 17 Mar 2011 - 20:00:22 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