[R] graphics

David Winsemius dwinsemius at comcast.net
Wed Oct 7 23:41:25 CEST 2009


On Oct 7, 2009, at 2:01 PM, McDonald, Grant wrote:

> Dear Sir,
>
> I am using the following cos which creates a 3 panel figure on one  
> image.  However the legend function i am using only allows the  
> legend to be placed within the axes of one of the graphs.
>
> The plots however do not allow for a logend to be places within the  
> axes do to the location of points on the graph.  I can add the  
> legend later using imaging software such as paint but i lose  
> resolution by doing this.
>
> Is it possible to place the legend out side of figure axes on the  
> white area around all three panels?
> Any help would be greatly appreciated.

Doesn't mtext let you do what you want?

perhaps:

mtext("Desired Text", outer=TRUE)


> single<-read.table("C:\\Grant\\hatchfirstonly.txt",header=T)
> attach(single)
> names(single)
> par(mfrow=c(1,3))
> maleage<- factor(maleage, labels = c("Old","Young"))
> colors <- c('gray', "navyblue")
> shapes <- c(17,19)
> proportion<-(eggs1-unhatch1)/eggs1
> plot(proportion~maleage, xlab= "Age of Male ", ylab = "Proportion of  
> Eggs Hatched")
> plot(proportion~femweight, pch=shapes[maleage],  
> col=colors[maleage],bg="gray", xlab= "Female Weight (grams) ", ylab  
> = " Proportion of Eggs Hatched")
> abline(lm(proportion~femweight))
> plot(proportion~copdurationsecs, pch=shapes[maleage],  
> col=colors[maleage],bg="gray", xlab= "Copulation Duration (minutes)  
> ", ylab = " Proportion of Eggs Hatched")
> abline(lm(proportion~copdurationsecs))
> legend(locator(1),  
> as.character(levels(factor(maleage))),pch=shapes[maleage],  
> col=colors[maleage])(levels(factor(maleage)))

David Winsemius, MD
Heritage Laboratories
West Hartford, CT




More information about the R-help mailing list