Could somebody program this kind of plot type to R, if none exists, based on mds or correlation tables or some more suitable method? What do you think about idea? Does it work? None similar or better exists? http://weightedassociationmap.blogspot.com/ Atte Tenkanen University of Turku, Finland
> Could somebody program this kind of plot type to R, if none exists, > based on mds or correlation tables or some more suitable method? > What do you think about idea? Does it work? None similar or better > exists? > > http://weightedassociationmap.blogspot.com/ > > > Atte Tenkanen > University of Turku, FinlandI got a hint of package ade4 and function dudi.pca. Something like this, though I can't immediately interpret those dudi.pca-pictures. I originally saw this as a more general idea, which can, if wanted, be applied with statistical methods too. If you do multidimensional scaling, you can see, how "near" all components are each other, but you can't see the connections or directions. If you have a correlation matrix, you can't see the connections graphically. Atte
Berta
2006-Sep-08 08:53 UTC
[R] how to construct stripchart with coincident points centered
Hi R-users, I am using stripchart with coincident points, y <-rbinom(100, 3, 0.5) stripchart(y, method="stack", pch="o", vertical=TRUE) But the result is not centered in the sense that if a value (say value 0) is repeated 7 times, the first point is ploted in the middle and the rest at its right side, in stead of ploting 3 at its right and 3 at its left. Can anybody help? Thanks, Berta.
Try the sna package. Below we calculate the correlation matrix, kor, of the numeric cols of builtin iris dataset. Zap negative ones and discretize rest to get lwd width matrix, lwd, used for edge widths. From that create the adjacency matrix, sign(lwd), and plot it using indicated layout mode. Seems like three of the variables are correlated and Sepal.Width is uncorrelated or negatively correlated to those. Try playing around with gplot args to create variations. library(sna) set.seed(123) # layout uses random numbers kor <- cor(iris[1:4]) lwd <- replace(kor, TRUE, 10 * round(pmax(0, kor), 1)) gplot(sign(lwd), edge.lwd = lwd, displaylabels = TRUE, label = rownames(kor)) On 9/8/06, kone <attenka at utu.fi> wrote:> Could somebody program this kind of plot type to R, if none exists, > based on mds or correlation tables or some more suitable method? What > do you think about idea? Does it work? None similar or better exists? > > http://weightedassociationmap.blogspot.com/ > > > Atte Tenkanen > University of Turku, Finland > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >
Actually the discretization does not appear to be needed. This works just as well: set.seed(123) kor <- cor(iris[1:4]) gplot(sign(kor), edge.lwd = 10*kor, displaylabels = TRUE, label = rownames(kor)) On 9/8/06, Gabor Grothendieck <ggrothendieck at gmail.com> wrote:> Try the sna package. Below we calculate the > correlation matrix, kor, of the numeric cols of builtin iris > dataset. Zap negative ones and discretize rest to > get lwd width matrix, lwd, used for edge widths. From > that create the adjacency matrix, sign(lwd), and plot it > using indicated layout mode. Seems like three of > the variables are correlated and Sepal.Width is uncorrelated > or negatively correlated to those. Try playing around with > gplot args to create variations. > > library(sna) > set.seed(123) # layout uses random numbers > kor <- cor(iris[1:4]) > lwd <- replace(kor, TRUE, 10 * round(pmax(0, kor), 1)) > gplot(sign(lwd), edge.lwd = lwd, displaylabels = TRUE, label = rownames(kor)) > > On 9/8/06, kone <attenka at utu.fi> wrote: > > Could somebody program this kind of plot type to R, if none exists, > > based on mds or correlation tables or some more suitable method? What > > do you think about idea? Does it work? None similar or better exists? > > > > http://weightedassociationmap.blogspot.com/ > > > > > > Atte Tenkanen > > University of Turku, Finland > > > > ______________________________________________ > > R-help at stat.math.ethz.ch mailing list > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > > and provide commented, minimal, self-contained, reproducible code. > > >
Robert Baer
2006-Sep-08 13:59 UTC
[R] how to construct stripchart with coincident points centered
You may be looking for: stripchart(y, method="jitter", pch="o", vertical=TRUE,jitter=.5) Rob ____________________________ Robert W. Baer, Ph.D. Associate Professor Department of Physiology A. T. Still University of Health Science 800 W. Jefferson St. Kirksville, MO 63501-1497 USA ----- Original Message ----- From: "Berta" <ibanez at bioef.org> To: <r-help at stat.math.ethz.ch> Sent: Friday, September 08, 2006 3:53 AM Subject: [R] how to construct stripchart with coincident points centered> Hi R-users, > I am using stripchart with coincident points, > > y <-rbinom(100, 3, 0.5) > stripchart(y, method="stack", pch="o", vertical=TRUE) > > But the result is not centered in the sense that if a value (say value 0)is> repeated 7 times, the first point is ploted in the middle and the rest at > its right side, in stead of ploting 3 at its right and 3 at its left. Can > anybody help? > > Thanks, > Berta. > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html> and provide commented, minimal, self-contained, reproducible code. >
Sorry to answer so late, but this is just what I want ;-) -Atte Gabor Grothendieck kirjoitti 8.9.2006 kello 14.53:> Actually the discretization does not appear to be needed. This > works just as well: > > set.seed(123) > kor <- cor(iris[1:4]) > gplot(sign(kor), edge.lwd = 10*kor, displaylabels = TRUE, label = > rownames(kor)) > > On 9/8/06, Gabor Grothendieck <ggrothendieck at gmail.com> wrote: >> Try the sna package. Below we calculate the >> correlation matrix, kor, of the numeric cols of builtin iris >> dataset. Zap negative ones and discretize rest to >> get lwd width matrix, lwd, used for edge widths. From >> that create the adjacency matrix, sign(lwd), and plot it >> using indicated layout mode. Seems like three of >> the variables are correlated and Sepal.Width is uncorrelated >> or negatively correlated to those. Try playing around with >> gplot args to create variations. >> >> library(sna) >> set.seed(123) # layout uses random numbers >> kor <- cor(iris[1:4]) >> lwd <- replace(kor, TRUE, 10 * round(pmax(0, kor), 1)) >> gplot(sign(lwd), edge.lwd = lwd, displaylabels = TRUE, label = >> rownames(kor)) >> >> On 9/8/06, kone <attenka at utu.fi> wrote: >> > Could somebody program this kind of plot type to R, if none exists, >> > based on mds or correlation tables or some more suitable method? >> What >> > do you think about idea? Does it work? None similar or better >> exists? >> > >> > http://weightedassociationmap.blogspot.com/ >> > >> > >> > Atte Tenkanen >> > University of Turku, Finland >> > >> > ______________________________________________ >> > R-help at stat.math.ethz.ch mailing list >> > https://stat.ethz.ch/mailman/listinfo/r-help >> > PLEASE do read the posting guide http://www.R-project.org/ >> posting-guide.html >> > and provide commented, minimal, self-contained, reproducible code. >> > >>
Berta
2006-Sep-11 07:39 UTC
[R] how to construct stripchart with coincident points centered
Thanks Rob for the clue, it is nearly but not exactly what I am looking for. If we plot the first figure as I want (but not centered) and the second figure as you suggest: win.graph(); par(mfrow=c(2,1)); y <-rbinom(100, 3, 0.5) stripchart(y, method="stack", pch="o", vertical=TRUE); abline(v=1) stripchart(y, method="jitter", pch="o", vertical=TRUE,jitter=.5); abline(v=1) we obtain "more or less" a symmetric plot in the second figure but points within the same value are not equally distanced as I wish (sorry, I did not tell this in the previous message). Is there a method in which I can obtain the first figure but with coincident points centered and equally distanced? Thanks again, Berta.> You may be looking for: > stripchart(y, method="jitter", pch="o", vertical=TRUE,jitter=.5) > > Rob> ----- Original Message ----->> Hi R-users, >> I am using stripchart with coincident points, >> >> y <-rbinom(100, 3, 0.5) >> stripchart(y, method="stack", pch="o", vertical=TRUE) >> >> But the result is not centered in the sense that if a value (say value 0) > is >> repeated 7 times, the first point is ploted in the middle and the rest at >> its right side, in stead of ploting 3 at its right and 3 at its left. >> Can >> anybody help? >> >> Thanks, >> Berta.
Great. In looking at it once more I realize that even the sign(kor) part could be shortened to just kor in this example. Regards. library(sna) set.seed(123) kor <- cor(iris[1:4]) gplot(kor, edge.lwd = 10*kor, displaylabels = TRUE, label = rownames(kor)) On 9/11/06, kone <attenka at utu.fi> wrote:> Sorry to answer so late, but this is just what I want ;-) > > -Atte > > Gabor Grothendieck kirjoitti 8.9.2006 kello 14.53: > > > Actually the discretization does not appear to be needed. This > > works just as well: > > > > set.seed(123) > > kor <- cor(iris[1:4]) > > gplot(sign(kor), edge.lwd = 10*kor, displaylabels = TRUE, label > > rownames(kor)) > > > > On 9/8/06, Gabor Grothendieck <ggrothendieck at gmail.com> wrote: > >> Try the sna package. Below we calculate the > >> correlation matrix, kor, of the numeric cols of builtin iris > >> dataset. Zap negative ones and discretize rest to > >> get lwd width matrix, lwd, used for edge widths. From > >> that create the adjacency matrix, sign(lwd), and plot it > >> using indicated layout mode. Seems like three of > >> the variables are correlated and Sepal.Width is uncorrelated > >> or negatively correlated to those. Try playing around with > >> gplot args to create variations. > >> > >> library(sna) > >> set.seed(123) # layout uses random numbers > >> kor <- cor(iris[1:4]) > >> lwd <- replace(kor, TRUE, 10 * round(pmax(0, kor), 1)) > >> gplot(sign(lwd), edge.lwd = lwd, displaylabels = TRUE, label > >> rownames(kor)) > >> > >> On 9/8/06, kone <attenka at utu.fi> wrote: > >> > Could somebody program this kind of plot type to R, if none exists, > >> > based on mds or correlation tables or some more suitable method? > >> What > >> > do you think about idea? Does it work? None similar or better > >> exists? > >> > > >> > http://weightedassociationmap.blogspot.com/ > >> > > >> > > >> > Atte Tenkanen > >> > University of Turku, Finland > >> > > >> > ______________________________________________ > >> > R-help at stat.math.ethz.ch mailing list > >> > https://stat.ethz.ch/mailman/listinfo/r-help > >> > PLEASE do read the posting guide http://www.R-project.org/ > >> posting-guide.html > >> > and provide commented, minimal, self-contained, reproducible code. > >> > > >> > >