[BioC] how to add a common legend to a 2 plots in a row?

James W. MacDonald jmacdon at med.umich.edu
Thu Apr 17 21:51:09 CEST 2008


Hi Carol,

There's undoubtedly better ways to do this (maybe with ggplots2?), but 
this is one way:

  layout(matrix(1:3, nrow=1), widths=c(1,0.5,1))
  plot(1:10)
  plot(1:10, bty="n", xaxt="n", yaxt="n", type="n", xlab="", ylab="")
  legend("topright", c("here is the","legend","in the middle"))
  plot(1:10)

see ?layout

Best,

Jim


carol white wrote:
> Hi,
> How to add a common legend (a list of text, in 1 column) to 2 plots displayed by par (mfrow = c(1,2)) in a row? i don't know how to add the legend between 2 plots or for ex, in the right upper corner of the right plots in the margin of the right plots when there is no place to display the legend in the plot region (overlapping problem). Any other suggestion to place the legend is welcome.
> 
> Regards,
> 
> carol 
> 
>        
> ---------------------------------
> 
> 	[[alternative HTML version deleted]]
> 
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor

-- 
James W. MacDonald, M.S.
Biostatistician
Affymetrix and cDNA Microarray Core
University of Michigan Cancer Center
1500 E. Medical Center Drive
7410 CCGC
Ann Arbor MI 48109
734-647-5623



More information about the Bioconductor mailing list