I'm trying to wean myself off the very limited capabilities of Excel and Oo. Currently, I am trying to make a plot showing several values for 2 categories in a dot blot (see http://www.nabble.com/file/p24538360/Picture%2B1.png Picture+1.png except that the x axis should contain the category not a number, which was the only way to coax Excel into displaying a plot like this). I started working through some tutorials but the example didn't quite fit what I was looking for. The closest was the car and mpg example but it 1 value per name whereas I need several value per category. Does anybody know this of the top of your expert heads? This would be a great help. I already burned a few hours without getting closer to the solution.. Best, j -- View this message in context: http://www.nabble.com/dot-plot-with-several-points-for-2-categories-tp24538360p24538360.html Sent from the R help mailing list archive at Nabble.com.
On Fri, Jul 17, 2009 at 7:17 PM, jaregi<suckale at mpi-cbg.de> wrote:> I'm trying to wean myself off the very limited capabilities of Excel and Oo. > Currently, I am trying to make a plot showing several values for 2 > categories in a dot blot (see > http://www.nabble.com/file/p24538360/Picture%2B1.png Picture+1.png ?except > that the x axis should contain the category not a number, which was the only > way to coax Excel into displaying a plot like this).Let y1 be a vector containing the values in the first category, and let y2 contain those of the second. The you could do like this: x1 = rep(1,times=length(y1)) x2 = rep(2,times=length(y2)) plot(c(x1,x2),c(y1,y2),xaxt="n") axis(side=1,at=c(1,2),labels=c("label1","label2")) It looks like a hack, but it should work. -- Michael Knudsen micknudsen at gmail.com http://lifeofknudsen.blogspot.com/
Hi, On Jul 17, 2009, at 1:17 PM, jaregi wrote:> > I'm trying to wean myself off the very limited capabilities of Excel > and Oo. > Currently, I am trying to make a plot showing several values for 2 > categories in a dot blot (see > http://www.nabble.com/file/p24538360/Picture%2B1.png Picture+1.png > except > that the x axis should contain the category not a number, which was > the only > way to coax Excel into displaying a plot like this). I started working > through some tutorials but the example didn't quite fit what I was > looking > for. The closest was the car and mpg example but it 1 value per name > whereas > I need several value per category. Does anybody know this of the top > of your > expert heads? This would be a great help. I already burned a few hours > without getting closer to the solution..Something like so? a <- rnorm(20, 10, 2) b <- rnorm(20, 15, 1) plot(jitter(rep(1, length(a))), a, ylim=c(0,20), xlim=c(0,3), xlab=NULL, xaxt='n') points(jitter(rep(2, length(b))), b) axis(1, c(1,2), labels=c('Group 1', 'Group 2')) Some points: * plot(..., xaxt='n') -- suppresses plotting of xaxis (see ?par) * I'm using jitter to add a bit of noise about the x vals so points don't draw ontop of eachother HTH, -steve -- Steve Lianoglou Graduate Student: Physiology, Biophysics and Systems Biology Weill Medical College of Cornell University Contact Info: http://cbio.mskcc.org/~lianos/contact
I use the long way, you might have to play around with my script to get is correct. once you get it to work, you can add as many points to reflect, median, percentile etc. ## generatiing vectors for Group1 a<-LMMP8[Self_T1D=="N"] w <- a[!is.na(a)] length(w) c<-mean(a, na.rm=TRUE) c n<-as.integer(length(w)/7) n n4<- length(w)-6*n n4 ###Generating vectors for T1D b<-LMMP8[Self_T1D=="Y"] x <- b[!is.na(b)] length(x) d<-mean (b, na.rm=TRUE) d m<-as.integer(length(x)/7) m m4<- length(x)-6*m m4 u<-append(w, x, after = length(w)) length(u) x<-c(rep(1:6,n),rep(7,n4), rep(11:16,m),rep(17,m4)) length(x) #####Plotting the data plot(x,u, ylab="Log MMP8",pch=19,cex.lab=1.5,lty=2,cex=1.1, cex.axis=1.25,xaxt="n") points(4,c,pch=25,col="red",lwd=5) points(14,d,pch=25,col="red",lwd=5) jaregi wrote:> > I'm trying to wean myself off the very limited capabilities of Excel and > Oo. Currently, I am trying to make a plot showing several values for 2 > categories in a dot blot (see > http://www.nabble.com/file/p24538360/Picture%2B1.png Picture+1.png except > that the x axis should contain the category not a number, which was the > only way to coax Excel into displaying a plot like this). I started > working through some tutorials but the example didn't quite fit what I was > looking for. The closest was the car and mpg example but it 1 value per > name whereas I need several value per category. Does anybody know this of > the top of your expert heads? This would be a great help. I already burned > a few hours without getting closer to the solution.. > > Best, j >-- View this message in context: http://www.nabble.com/dot-plot-with-several-points-for-2-categories-tp24538360p24573397.html Sent from the R help mailing list archive at Nabble.com.