On 12/19/2013 11:18 AM, Luigi Marongiu wrote:
dear all, i would like to plot the value of different response groups. when i simply use plot(y ~ x) i obtain a series of boxplots. i would rather use dots. i also tried with stripchart(y ~ x), which gives better results but does not place properly the labels since place them alphabetically. in addition i actually have 6 response groups: 3 classes (low, medium, high) and 2 sampling time (12 and 18 months). how can i generate these individual groups and plot them in the correct order (low, medium, high and 12, 18)? i believe is something to do with the factors but i don't know how to implement them.
Hi Luigi, Perhaps you want something like this: lmdf<-read.table(text="time class value 18 medium 2.92 18 medium 0.01 18 medium 0.36 18 medium 3.16 18 medium 0.99 18 medium 0.38 18 medium 0.01 18 medium 5.1 18 medium 0.04 18 medium 0.01 18 medium 1.33 18 medium 4.13 18 medium 0.15 18 medium 0.15 18 high 14.18 18 high 4290.14 18 high 26.8 18 high 5.33 18 high 17.58 18 high 14.29 18 high 248.5 18 low 0.01 18 low 0 18 low 0 18 low 0 18 low 0 18 low 0 18 low 0 12 medium 0.151395382 12 medium 5.327863403 12 medium 5.10096383 12 medium 1.32567787 12 medium 4.352404124 12 medium 0.458606982 12 medium 2.915908912 12 medium 0.011996374 12 medium 0.364710382 12 medium 0.033016026 12 medium 3.161701212 12 medium 0.381564497 12 medium 0.010971385 12 medium 0.035646472 12 medium 0.014781805 12 medium 4.129708296 12 medium 0.153094117 12 medium 0.018497847 12 high 15.09178491 12 high 17.58393041 12 high 14.17643928 12 high 4290.143561 12 high 26.79730719 12 high 294.6367065 12 high 14.2888441 12 high 248.495231 12 high 209.3131795 12 high 2014.506722 12 low 0.010751273 12 low 0.002325138 12 low 0.000637473 12 low 0.003984336 12 low 0.006018154 12 low 0.003620907 12 low 7.46E-05 12 low 0.000142311 12 low 0.002460417 12 low 0.001280189",header=TRUE) # get the factor levels in the correct order lmdf$class<-factor(lmdf$class,levels=c("low","medium","high")) library(plotrix) brkdn.plot("value","class","time",lmdf,col=2:4) legend(14,1200,c("low","medium","high"),col=2:4,lty=1) Jim ______________________________________________ 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.