[R] Easy help with plots, font size

David Winsemius dwinsemius at comcast.net
Fri Feb 4 03:23:07 CET 2011


On Feb 3, 2011, at 7:12 PM, gigi1234 wrote:

>
> I am trying to make some plots for a poster. Each one needs to be 6  
> inches by
> inches. Right now the fonts are too small and the plots don't read  
> well on
> my poster. I am pretty much an R newbie and I can't figure out how  
> to change
> the fonts. It would also be nice to know how to specify the size of  
> the plot
> and maybe how to save the plots as jpeg files. Any help would be much
> appreciated! I am not too picky about the details like font type, I  
> just
> want the size of the fonts (especially the axes and axes labels) to be
> bigger!

?par

cex, cex.main,  cex.lab, and cex.axis are arguments that should be  
helpful to control various font sizes.

?Devices
?jpeg

The device settings are where you can change the plot size. There are  
examples on the help pages.


>
> Thanks so much!
>
> Here is my code:
>
> # Poster figure 1
>
> stationmean=c(19.4833,10.8000)
> fieldmean=c(14.6852, 15.5981)
>
> plot(c(0,1),fieldmean,xaxt='n',type="b",pch=20,col="green3",
> 	main="Foxtail Seeds Remaining vs.Field Type", ylab="Mean Number  
> Foxtail
> Seeds Remaining",
> 	xlab="Field Type",ylim=c(10,20),xlim=c(-.25,1.25))
> axis(1,at=c(0,1),labels=c("Cover Crop","Wheat Stubble"))
>
> # Poster figure 2
>
> stationmean=c(19.4833,10.8000)
> fieldmean=c(14.6852, 15.5981)
>
> plot(c(0,1),stationmean,xaxt='n',type="b",pch=20,col="green3",
> 	main="Foxtail Seeds Remaining vs. Station Type", ylab="Mean Number  
> Foxtail
> Seeds Remaining",
> 	xlab="Station Type",ylim=c(10,20),xlim=c(-.25,1.25))
> axis(1,at=c(0,1),labels=c("Invertebrate Only","Open Access"))
>
> # Poster figure 3
>
> meantime=22.1
> meancumrainfall=.4837
> meanavelowt=35.4920071
> meanavehight=55.3242738
> meanvegcover=81.1729167
>
> pred.veg = 33.3160 + -.2439*meantime - .8409*(.5) + 8.6833*(.5) +
> 	.5427*(meancumrainfall)-.3087*(meanavehight) +
> 	.01087*(seq(0,164.5,by=5))
> pred.veg
>
> plot(seq(0,164.5,by=5),pred.veg,type='l',col='blue',lwd=2,
> 	main='Foxtail Seeds Remaining vs. Vegetative Cover Biomass',
> xlab='Vegetative Cover Biomass (g / 0.25 m^2',
> 	ylab='Mean Number Foxtail Seeds Remaining',ylim=c(10,22))
>
> # Poster figure 4
>
> meantime=22.1
> meancumrainfall=.4837
> meanavelowt=35.4920071
> meanavehight=55.3242738
> meanvegcover=81.1729167
>
> pred.rain = 33.3160 + -0.2439*meantime - .8409*(.5) + 8.6833*(.5) -
> 	1.0571*(seq(0,1.569,by=.1))-.3087*(meanavehight) +
> 	.01087*(meanvegcover)
> pred.rain
>
> plot(seq(0,1.569,by=.1),pred.rain,type='l',col='blue',lwd=2,
> 	main='Foxtail Seeds Remaining vs. Cumulative Rainfall',  
> xlab='Cumulative
> Rainfall (in)',
> 	ylab='Mean Number Foxtail Seeds Remaining',ylim=c(10,22))
>
> # Poster figure 5
>
> meantime=22.1
> meancumrainfall=.4837
> meanavelowt=35.4920071
> meanavehight=55.3242738
> meanvegcover=81.1729167
>
> pred.high = 33.3160 + -.2439*meantime - .8409*(.5) + 8.6833*(.5) +
> 	1.0571*(meancumrainfall)-.3087*(seq(37.733,74.38228571,by=1)) +
> 	.01087*(meanvegcover)
> pred.high
>
> plot(seq(37.733,74.38228571,by=1),pred.high,type='l',col='blue',lwd=2,
> 	main='Foxtail Seeds Remaining vs. Average Daily High Temp',  
> xlab='Average
> Daily High Temperature (degrees F)',
> 	ylab='Mean Number Foxtail Seeds Remaining',ylim=c(10,22))
>
> # Poster figure 6
>
> meantime=25.3333333
> meancumrainfall=.4015
> meanavelowt=37.9325
> meanavehight=62.2579683
> meanvegcover=77.6145833
> meannumtotseedwt=.8708333
>
> pred.seed = 24.4096 + -.1930*meantime - 3.5233*(.5) + 11.8611*(.5) -
> 	2.7335*(meancumrainfall)-.1510*(meanavehight) +
> 	.01286*(meanvegcover) - 3.2848*(seq(.2,1.6,by=.05))
> pred.seed
>
> plot(seq(.2,1.6,by=.05),pred.seed,type='l',col='blue',lwd=2,
> 	main='Foxtail Seeds Remaining vs. Ambient Seed Load', xlab='Ambient  
> Seed
> Load (g / 0.25 m^2',
> 	ylab='Mean Number Foxtail Seeds Remaining',ylim=c(8,16))
>
> -- 
> View this message in context: http://r.789695.n4.nabble.com/Easy-help-with-plots-font-size-tp3259270p3259270.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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
West Hartford, CT



More information about the R-help mailing list