[R] par code help
sbarr2 at gmail.com
sbarr2 at gmail.com
Wed Jun 22 01:36:14 CEST 2011
You might try:
text(xvals,-50,labels=speciesnames,cex=.7,xpd=T)
You can also make the plot wider. There are a number of ways to do
this. For example (on a mac):
quartz(width=10,height=6)
or simply stretch it
On Tue, Jun 21, 2011 at 4:29 PM, Adrienne Keller
<adrienne.keller at gmail.com> wrote:
> I am making a barplot using barplot2 from gplots where each bar represents a
> specific tree species. I have formatted the species names on the x-axis so
> that the genus name is above the species name and have then rotated the
> labels 45 degrees to save room. This is my code:
>
>>columncolor<-c("grey20", "grey20", "grey20", "grey70", "grey70", "grey70",
>> "grey70", "grey70", "grey70")
>>speciesnames<-c("Dialium\nguianensis", "Inga\nalba",
>> "Tachigali\nversicolor", "Brosimum\nutile", "Caryocar\ncostaricense",
>> "Castilla\ntunu", "Otoba\nnovagranatensis", "Pourouma\nbicolor",
>> "Socratea\nexorrhiza")
>>barplot2(meanapAprilactivity, names.arg=speciesnames, col=columncolor,
>> xlab="Species", ylab="Soil acid phosphatase activity (nmol/h/g)",
>> ylim=c(0,1000), plot.ci=T, ci.l=apAprilminusordered,
>> ci.u=apAprilplusordered, cex.lab=1.5)#FinalGraphs>aPApril_Genus.pdf
>>xvals<-barplot2(meanapAprilactivity, col=columncolor, xlab="Species",
>> ylab="Soil acid phosphatase activity (nmol/h/g)", ylim=c(0,1000), plot.ci=T,
>> ci.l=apAprilminusordered, ci.u=apAprilplusordered,
>> cex.lab=1.5)#FinalGraphs>aPApril_Genus.pdf
>>text(xvals,par("usr")[3]-1, srt=45, adj=0.5,labels=speciesnames, xpd=T)
>
> I have a few problems/questions:
>
> 1) The middle of the species names are placed at the bottom of the bar, such
> that half of the label is in the figure.
>
> 2) There is too much of a space between the genus and species name (e.g.
> between Dialium and guianensis for my first species)
>
> 3) Do I use cex.axis to change the font size of the labels and cex.lab to
> change the font size of xlab and ylab?
>
> I don't understand par() well enough to know what to change. I figured
> changing the numbers after "usr" might help but I don't understand what
> these numbers refer to and guess and check hasn't gotten me anywhere.
>
> Thanks,
>
>
> Adrienne Keller
> Graduate Student, College of Forestry
> University of Montana
> adrienne.keller at umontana.edu
> (Phone) 651-485-5822
>
> ______________________________________________
> 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.
>
More information about the R-help
mailing list