Situation of the legend in the plotPCA of the affycoretools library
1
0
Entering edit mode
@jordi-altirriba-gutierrez-682
Last seen 3.5 years ago
Dear BioC users, 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? Many thanks in advance! 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" Jordi Altirriba PhD student Hospital Clinic (Barcelona, Spain)
GO Survival cdf annotate genefilter multtest affy graph limma RBGL GOstats Category GO • 1.5k views
ADD COMMENT
0
Entering edit mode
@james-w-macdonald-5106
Last seen 1 day ago
United States
Hi Jordi, Jordi Altirriba Guti?rrez wrote: > Dear BioC users, > 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?). Anyway, the function is set up to automagically place the legend in one of the corners of the plot based on having space for the legend to fit, and if there isn't space in a corner, to ask the end user where to put it. I suppose I could modify the function to accept a legend location if there is a good reason to override the automatic placement. Best, Jim > Many thanks in advance! > > 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" > > Jordi Altirriba > PhD student > Hospital Clinic (Barcelona, Spain) > > _______________________________________________ > 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 ********************************************************** Electronic Mail is not secure, may not be read every day, and should not be used for urgent or sensitive issues.
ADD COMMENT
0
Entering edit mode
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 .... 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"
ADD REPLY
0
Entering edit mode
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.
ADD REPLY

Login before adding your answer.

Traffic: 372 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6