hello, ladyes and gentlemans. check this: means<-c(4,6,8) stand.error<-c(0.1,0.3,0.5) now i've strongly tryed to scatterplot the means(y-axis),by showing their sd with the arrow(..,code=3,angle=90) function. The problem is that my x-axis has categorical values (say, factor(x)), and the arrows() can't recognize them as right coordinates. ????? thank you all in advance B.F. insubria university (varese) La web mail pi? usata?al mondo. http://it.docs.yahoo.com/mail/overview/index.html
hi Giacomo, consider this: means<-c(4,6,8) stand.error<-c(0.1,0.3,0.5) lowlim<-means-stand.error uplim<-means+stand.error plot(as.factor(c("a","b","c")),means,ylim=c(min(lowlim),max(uplim))) arrows(c(1:3),lowlim,c(1:3),uplim,code=3,angle=90) Still, its just a workaround and I don't think you can get rid of the horizontal mean-lines because this is actually a box-plot. Otherwise you could try the 'errbar()' from the Hmisc package. I never used that, but maybe it works. Generally, if you have problems with plot-dimensions, you can get instant information with 'locator()', which returns coordinates of mouse clicked locations in plots. cheers, /ren?> -----Urspr?ngliche Nachricht----- > Von: "Giacomo Prodi" <bonoricus at yahoo.it> > Gesendet: 12.03.08 11:56:45 > An: r-help at r-project.org > Betreff: [R] hello! i need help for a specific graphic issue> > hello, ladyes and gentlemans. > > check this: > > means<-c(4,6,8) > stand.error<-c(0.1,0.3,0.5) > > now i've strongly tryed to scatterplot the > means(y-axis),by showing their sd with the > arrow(..,code=3,angle=90) function. > The problem is that my x-axis has categorical values > (say, factor(x)), and the arrows() can't recognize > them as right coordinates. > ????? > thank you all in advance > B.F. insubria university (varese) > > > > La web mail pi? usata al mondo. http://it.docs.yahoo.com/mail/overview/index.html > > ______________________________________________ > R-help at 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. >_______________________________________________________________ Schon geh?rt? Der neue WEB.DE MultiMessenger kann`s mit allen: http://www.produkte.web.de/messenger/?did=3015
On Wed, Mar 12, 2008 at 5:37 AM, Giacomo Prodi <bonoricus at yahoo.it> wrote:> hello, ladyes and gentlemans. > > check this: > > means<-c(4,6,8) > stand.error<-c(0.1,0.3,0.5) > > now i've strongly tryed to scatterplot the > means(y-axis),by showing their sd with the > arrow(..,code=3,angle=90) function. > The problem is that my x-axis has categorical values > (say, factor(x)), and the arrows() can't recognize > them as right coordinates. > ????? > thank you all in advance > B.F. insubria university (varese)This is a bit easier to do with ggplot2: df <- data.frame( trt = factor(c("a", "b", "c")), mean = c(4,6,8), se = c(0.1,0.3,0.5) ) install.packages("ggplot2") library(ggplot2) qplot(trt, mean, data=df) qplot(trt, mean, data=df, min=mean - se, max = mean + se, geom="pointrange") Hadley -- http://had.co.nz/
quick (and dirty) solution: y.up<- means+stand.error y.dwn<- means-stand.error plot(means,ylim=c(3.5,10)) for (i in 1:length(means)) arrows(i,means[i],i,y.up[i],length=0.1) for (i in 1:length(means)) arrows(i,means[i],i,y.dwn[i],length=0.1) Giacomo Prodi wrote:> > hello, ladyes and gentlemans. > > check this: > > means<-c(4,6,8) > stand.error<-c(0.1,0.3,0.5) > > now i've strongly tryed to scatterplot the > means(y-axis),by showing their sd with the > arrow(..,code=3,angle=90) function. > The problem is that my x-axis has categorical values > (say, factor(x)), and the arrows() can't recognize > them as right coordinates. > ????? > thank you all in advance > B.F. insubria university (varese) > > > > La web mail pi? usata?al mondo. > http://it.docs.yahoo.com/mail/overview/index.html > > ______________________________________________ > R-help at 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/hello%21-i-need-help-for-a-specific-graphic-issue-tp16002183p16002532.html Sent from the R help mailing list archive at Nabble.com.
I don't think that you're actually creating a scatterplot if the x-axis is a factor. You're getting a boxplot. If you want a scatterplot then something like this might work. ===================================================== means<-c(4,6,8) stand.error<-c(0.1,0.3,0.5) aa <- factor(c("A","B","C","A", "C", "C")) dd <- 1:length(levels(aa)) plot(dd, means, xaxt="n") arrows(dd, means + stand.error, dd, means-stand.error, code=3, angle=90) axis(1, at=dd, labels=levels(aa)) ====================================================== --- Giacomo Prodi <bonoricus at yahoo.it> wrote:> hello, ladyes and gentlemans. > > check this: > > means<-c(4,6,8) > stand.error<-c(0.1,0.3,0.5) > > now i've strongly tryed to scatterplot the > means(y-axis),by showing their sd with the > arrow(..,code=3,angle=90) function. > The problem is that my x-axis has categorical values > (say, factor(x)), and the arrows() can't recognize > them as right coordinates. > ????? > thank you all in advance > B.F. insubria university (varese) > > > > La web mail pi? usata al mondo. > http://it.docs.yahoo.com/mail/overview/index.html > > ______________________________________________ > R-help at 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. >
Seemingly Similar Threads
- convert variable types when creating data frame from cor.test results
- problems on plotting adjacent bars with barplot. Help request, please
- Error with custom function in apply: Error in FUN(newX[, i], ...) : unused argument(s) (newX[, i])
- CI on median
- problems importing file