[BioC] Situation of the legend in the plotPCA of the affycoretools library
James W. MacDonald
jmacdon at med.umich.edu
Fri Sep 29 03:49:34 CEST 2006
Hi Jordi,
Jordi Altirriba Gutiérrez wrote:
> Hi James,
>
> First of all many thanks for your answer and the package!
>
>>> I am trying to do a PCA plot with the package affycoretools, which I
>>> have found very useful!
>>> I am not able to change the situation of the legend in the plot,
>>> although I have introduced the variables x.coord and y.coord in the
>>> script. Could it be a little bug or am I doing something wrong?
>>>
>>
>> No bug, just a misunderstanding. There are no arguments x.coord or
>> y.coord (actually, I don't think these are arguments for any plotting
>> function that I can think of - where did you get the idea you could
>> pass these as arguments?).
>
> I got this argument from the plotPCA help:
>
>> ?plotPCA
> ....
> Usage:
>
> plotPCA(eset, groups, groupnames, addtext = NULL, x.coord = NULL,
> y.coord = NULL, screeplot = FALSE, squarepca = FALSE)
>
> ....
>
> x.coord: Pass an x-coordinate if automatic legend placement fails
>
> y.coord: Pass a y-coordinate if automatic legend placement fails
>
> ....
Blush. Seems I know very little about my own package :-/
OK, so it's not technically a bug, because as the help indicates, the
x.coord and y.coord values are only used if the automatic legend
placement fails. However, one could argue that these are pretty stupid
arguments given that you will be asked for an x and y coordinate if the
placement fails, and how would anybody know a priori where the legend
will fit, or what the x and y axis ranges will be...
My first reaction is to remove these two arguments and stick with the
automatic legend placement, the logic being that one would never know
where the legend should go before the plot is made anyway. The only
reasonable alternative I can think of would be to allow one to pass one
of ("topright","topleft","bottomright", "bottomleft") to force the
legend into a corner, regardless of where the plotting symbols are.
Is this the sort of behavior you are looking for?
Best,
Jim
>
> Many thanks in advance,
>
> Jordi Altirriba
> PhD student
> Hospital Clinic (Barcelona, Spain)
>
>
>>> This is my code:
>>> library(affycoretools)
>>> Data<-ReadAffy()
>>> eset<-rma(Data)
>>> pd <- read.phenoData("pdata2.txt", header = TRUE, row.names = 1)
>>> plotPCA(eset,groups = rep(1:2, each = 3), groupnames =
>>> unique(pData(pd))[,1],addtext=sampleNames(Data))
>>>
>>> I obtain exactly the same plot writing:
>>> plotPCA(eset,groups = rep(1:2, each = 3), groupnames =
>>> unique(pData(pd))[,1],addtext=sampleNames(Data),x.coord=0,y.coord=0)
>>>
>>> My session:
>>>
>>>> sessionInfo()
>>>>
>>> Version 2.3.1 (2006-06-01)
>>> i386-pc-mingw32
>>>
>>> attached base packages:
>>> [1] "splines" "tools" "methods" "stats" "graphics"
>>> "grDevices"
>>> [7] "utils" "datasets" "base"
>>>
>>> other attached packages:
>>> rat2302cdf affycoretools GOstats Category hgu95av2
>>> "1.12.0" "1.4.0" "1.6.0" "1.4.1" "1.12.0"
>>> KEGG multtest genefilter survival xtable
>>> "1.12.0" "1.10.2" "1.10.1" "2.28" "1.3-2"
>>> RBGL annotate GO graph Ruuid
>>> "1.8.1" "1.10.0" "1.12.0" "1.10.6" "1.10.0"
>>> limma affy affyio Biobase
>>> "2.7.10" "1.10.0" "1.0.0" "1.10.1"
>
>
--
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
**********************************************************
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