[BioC] simpleaffy question

James W. MacDonald jmacdon at med.umich.edu
Sun Dec 10 20:06:54 CET 2006

J.delasHeras at ed.ac.uk wrote:
> Quoting "James W. MacDonald" <jmacdon at med.umich.edu>:
>> J.delasHeras at ed.ac.uk wrote:
>>> Quoting "D.Enrique ESCOBAR ESPINOZA" <escobarebio at yahoo.com>:
>>>> HI ,
>>>> does someone know if there is a built-inn
>>>> function for adding a legend to the QC grph obtained
>>>> with :
>>>> data(Dilution)
>>>> plot(qc(Dilution))
>>>> or if there is an easy way to add a legend to this graph
>>>> thanks.
>>> In general I find that one or some of these functions help me   
>>> annotate any plot in R:
>>> ?text
>>> ?mtext
>>> ?title
>>> ?legend
>>> I presume you probably were looking for 'legend'.
>> Unfortunately legend won't work in this case. The qc() plot is produced
>> after a call to layout(), which cuts the plotting device into four
>> sections. The last section to be plotted is the upper left hand, which
>> contains the names of the QC probesets. If you make a call to legend(),
>> it will put the legend in that very small section, most likely right on
>> top of the names of the QC probesets.
>> To see what I mean, try this code (which comes directly from this
>> plotting function):
>> m <- matrix(c(4, 2, 1, 3), nrow = 2, ncol = 2)
>> layout(m, c(1, 2), c(0.1, 1))
>> layout.show(4)
>> The plots will be added to each box in the order listed.
>> That said, if you want to hack the code it wouldn't be that difficult
>> to  add a call to legend() right after the second call to plot() in the
>> function plot.qc.stats(). This will put a legend in the second layout
>> box, which currently only contains the chip names on the extreme right
>> edge. If you placed the legend "upperleft" and made the font size small
>> enough, it might fit.
>> Luckily, since simpleaffy doesn't use a namespace, you can simply
>> copy-paste the function into an editor, hack away, then source() back
>> in and go.
>> HTH,
>> Jim
> whops!
> I wasn't familiar with the qc() plots, so I assumed they were straight  
> plots. Sorry!
> Your idea to just get into the qc() code and add a call to legend as  
> required seems good and simple enough.
> Is there a function in R that allows you to plot polygons, circles,  
> etc... *anywhere*? Something similar to 'mtext', only not just for text?
> I often multiplot figures, using 'par(mfrow=c(x,y))' among other  
> suitable parameters to fit several plots consecutively into a larger  
> figure. Then I use 'mtext' to place text information anywhere in the  
> final multiplot figure. It works well enough. If there is an  equivalent 
> funtion that you can sue to draw lines, rectangles etc with  in teh same 
> fashion, that would work too.

The only functions I know for plotting shapes require (x,y) coordinates, 
so won't work like mtext(). However, one might be able to come up with a 
reasonable looking legend just using mtext().



> Jose

James W. MacDonald
University of Michigan
Affymetrix and cDNA Microarray Core
1500 E Medical Center Drive
Ann Arbor MI 48109

Electronic Mail is not secure, may not be read every day, and should not be used for urgent or sensitive issues.

More information about the Bioconductor mailing list