Hi all; The followings are my R codes for heat maps in ggplot2. I need to specify the font size for the y-axis (x-axis works) as well as font size for label y and x too. Your help highly appreciated. Thanks, Greg qplot(x=Var1, y=Var2, data=melt(cor(a, use="p")), fill=value, geom="tile") + scale_fill_gradient2(limits=c(-1, 1))+ ylab('Super pathways') + xlab('Significant Metabolites in Super pathways for DI') + theme(axis.text.x = element_text(angle = 90, hjust = 1, size=6)) [[alternative HTML version deleted]]
Hi Greg, ?theme You can use the axis.text and axis.title if y and x are to be identical, or axis.text.x, axis.text.y, axis.title.x, axis.title.y if you need different font size. HTH Ulrik On Fri, 10 Mar 2017 at 15:47 greg holly <mak.hholly at gmail.com> wrote:> Hi all; > > The followings are my R codes for heat maps in ggplot2. I need to specify > the font size for the y-axis (x-axis works) as well as font size for label > y and x too. Your help highly appreciated. > > Thanks, > > Greg > > qplot(x=Var1, y=Var2, data=melt(cor(a, use="p")), fill=value, geom="tile") > + > scale_fill_gradient2(limits=c(-1, 1))+ > ylab('Super pathways') + > xlab('Significant Metabolites in Super pathways for DI') + > theme(axis.text.x = element_text(angle = 90, hjust = 1, size=6)) > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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. >[[alternative HTML version deleted]]
Thanks Ulrik for this, This is my first experience in heat maps. Yours advise for the theme would be appreciated. Greg On Fri, Mar 10, 2017 at 10:08 AM, Ulrik Stervbo <ulrik.stervbo at gmail.com> wrote:> Hi Greg, > > ?theme > > You can use the axis.text and axis.title if y and x are to be identical, > or axis.text.x, axis.text.y, axis.title.x, axis.title.y if you need > different font size. > > HTH > Ulrik > > On Fri, 10 Mar 2017 at 15:47 greg holly <mak.hholly at gmail.com> wrote: > >> Hi all; >> >> The followings are my R codes for heat maps in ggplot2. I need to specify >> the font size for the y-axis (x-axis works) as well as font size for label >> y and x too. Your help highly appreciated. >> >> Thanks, >> >> Greg >> >> qplot(x=Var1, y=Var2, data=melt(cor(a, use="p")), fill=value, >> geom="tile") + >> scale_fill_gradient2(limits=c(-1, 1))+ >> ylab('Super pathways') + >> xlab('Significant Metabolites in Super pathways for DI') + >> theme(axis.text.x = element_text(angle = 90, hjust = 1, size=6)) >> >> [[alternative HTML version deleted]] >> >> ______________________________________________ >> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >> 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. >> >[[alternative HTML version deleted]]
This could be as simple as looking at the parameter "axis.text.x" and thinking "maybe there is another parameter called axis.text.y that I could try" and reading the ggplot2 help pages for the theme and element_text functions. If not then you need to make your example complete enough (including just enough data to illustrate a problem) that we can run your code and see what you see and hopefully understand why you have a problem. Note that the Posting Guide warns you that this is a plain text mailing list, so any pretty HTML formatting or images you use to try to communicate your problem won't reach us and the HTML will very likely garble your example code so that it will no longer run, so please set your email program to send only plain text and illustrate your difficulty using R code. Look for "R reproducible example" in an Internet search engine for more help. -- Sent from my phone. Please excuse my brevity. On March 10, 2017 6:45:14 AM PST, greg holly <mak.hholly at gmail.com> wrote:> Hi all; > >The followings are my R codes for heat maps in ggplot2. I need to >specify >the font size for the y-axis (x-axis works) as well as font size for >label >y and x too. Your help highly appreciated. > >Thanks, > >Greg > >qplot(x=Var1, y=Var2, data=melt(cor(a, use="p")), fill=value, >geom="tile") + > scale_fill_gradient2(limits=c(-1, 1))+ > ylab('Super pathways') + > xlab('Significant Metabolites in Super pathways for DI') + > theme(axis.text.x = element_text(angle = 90, hjust = 1, size=6)) > > [[alternative HTML version deleted]] > >______________________________________________ >R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >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.