Re: [R] stars (as fourfold plots) in plot (symbols don't work)
Here are 2 useful paths (it's up to you to decide if either is the right path). The my.symbols function in the TeachingDemos package allows you to create your own functions to create the symbols. But in this case, you can just use the locations argument to the stars function: stars(cbind(1,sqrt(test[,3]), 1, sqrt(test[,3]))/16, locations=test[,1:2], + col.segments=c(gray90, gray),draw.segments=TRUE, scale=FALSE) -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of maiya Sent: Saturday, June 06, 2009 4:03 PM To: r-help@r-project.org Subject: [R] stars (as fourfold plots) in plot (symbols don't work) Hi! I have a dataset with three columns -the first two refer to x and y coordinates, the last one are odds ratios. I'd like to plot the data with x and y coordinates and the odds ratio shown as a fourfold plot, which I prefer to do using the stars function. Unfortunately the stars option in symbols is not as cool as the stars function on its own, and now i can't figure out how to do it! here's an example code: #data test-cbind(c(1,2,3,4), c(1,2,3,4), c(2,4,8,16)) #this is what I want the star symbol to look like stars(cbind(1,sqrt(test[1,3]), 1, sqrt(test[1,3])), col.segments=c(gray90, gray),draw.segments=TRUE, scale=FALSE) #this is what happens when using stars in symbols symbols(test[,1], test[,2], stars=cbind(1,sqrt(test[,3]), 1, sqrt(test[,3]))) Can anyone set me on the right path please? Maja -- View this message in context: http://www.nabble.com/stars-%28as- fourfold-plots%29-in-plot-%28symbols-don%27t-work%29- tp23905987p23905987.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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. __ R-help@r-project.org 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.
Re: [R] stars (as fourfold plots) in plot (symbols don't work)
I was feeling pretty silly when I saw there was actually a locations parameter in stars, as well as axes etc. But now the problem is that the x and y axes in stars must be on the same scale! Which unfortunately makes my data occupy only a very narrow band of the plot. I guess one option would be to scale one set of coordinates and then manually change the axis labels!? But I'll have a look at my.symbols first. Thanks for the tip! Maja Greg Snow-2 wrote: Here are 2 useful paths (it's up to you to decide if either is the right path). The my.symbols function in the TeachingDemos package allows you to create your own functions to create the symbols. But in this case, you can just use the locations argument to the stars function: stars(cbind(1,sqrt(test[,3]), 1, sqrt(test[,3]))/16, locations=test[,1:2], + col.segments=c(gray90, gray),draw.segments=TRUE, scale=FALSE) -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of maiya Sent: Saturday, June 06, 2009 4:03 PM To: r-help@r-project.org Subject: [R] stars (as fourfold plots) in plot (symbols don't work) Hi! I have a dataset with three columns -the first two refer to x and y coordinates, the last one are odds ratios. I'd like to plot the data with x and y coordinates and the odds ratio shown as a fourfold plot, which I prefer to do using the stars function. Unfortunately the stars option in symbols is not as cool as the stars function on its own, and now i can't figure out how to do it! here's an example code: #data test-cbind(c(1,2,3,4), c(1,2,3,4), c(2,4,8,16)) #this is what I want the star symbol to look like stars(cbind(1,sqrt(test[1,3]), 1, sqrt(test[1,3])), col.segments=c(gray90, gray),draw.segments=TRUE, scale=FALSE) #this is what happens when using stars in symbols symbols(test[,1], test[,2], stars=cbind(1,sqrt(test[,3]), 1, sqrt(test[,3]))) Can anyone set me on the right path please? Maja -- View this message in context: http://www.nabble.com/stars-%28as- fourfold-plots%29-in-plot-%28symbols-don%27t-work%29- tp23905987p23905987.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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. __ R-help@r-project.org 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. -- View this message in context: http://www.nabble.com/stars-%28as-fourfold-plots%29-in-plot-%28symbols-don%27t-work%29-tp23905987p23933876.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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.
[R] stars (as fourfold plots) in plot (symbols don't work)
Hi! I have a dataset with three columns -the first two refer to x and y coordinates, the last one are odds ratios. I'd like to plot the data with x and y coordinates and the odds ratio shown as a fourfold plot, which I prefer to do using the stars function. Unfortunately the stars option in symbols is not as cool as the stars function on its own, and now i can't figure out how to do it! here's an example code: #data test-cbind(c(1,2,3,4), c(1,2,3,4), c(2,4,8,16)) #this is what I want the star symbol to look like stars(cbind(1,sqrt(test[1,3]), 1, sqrt(test[1,3])), col.segments=c(gray90, gray),draw.segments=TRUE, scale=FALSE) #this is what happens when using stars in symbols symbols(test[,1], test[,2], stars=cbind(1,sqrt(test[,3]), 1, sqrt(test[,3]))) Can anyone set me on the right path please? Maja -- View this message in context: http://www.nabble.com/stars-%28as-fourfold-plots%29-in-plot-%28symbols-don%27t-work%29-tp23905987p23905987.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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.