[R] plot two columns of a matrix with standard deviation

Henrique Dallazuanna wwwhsd at gmail.com
Thu Feb 21 20:45:08 CET 2008


Perhaps:

plot(x[c(1,3)], pch=16)
segments(x[,1],x[,3]-x[,2], x[,1], x[,3]+x[,4], col="red")


On 21/02/2008, Paul Hammer <paul.hammer at tfh-wildau.de> wrote:
> hi members,
>
>  i try to plot two columns of a matrix as points with standard deviation.
>  a legend should also be there. the one points should be green and the
>  others red...
>
>  column 1 and 3 are the values to plot and column 2 and 4 are the
>  attendant standard deviation (sd)... as xlab should show the rownames. i
>  tried a lot of attempts but without success:(...
>
>  R code:
>   > PDE1A_int_sd_avg[1:4]
>
>         prostate_avg prostate_sd breast_avg breast_sd
>  2590617     7.057866  0.65549017   6.922251 0.1240702
>  2590616     4.407165  0.51983406   4.127747 0.4471652
>  2590615     4.806831  0.58847360   4.309884 0.1884463
>  2590618     3.314213  1.02590469   3.310029 0.6075215
>  2590612     7.878071  0.34838454   6.961996 0.4294136
>  2590613     7.148809  0.63653777   6.013015 0.6484706
>  2590611     5.382736  0.51058425   4.669508 0.5124079
>  2590607     4.448152  1.54271678   3.377348 0.6634425
>  2590608     4.184283  0.44209393   2.767696 0.3458292
>  2590606     6.237610  0.15831587   4.900560 0.3556708
>  2590601     2.871831  0.13629742   2.427491 0.7291913
>  2590600     2.777127  1.50248150   3.181344 0.2703518
>  2590599     3.854438  0.12178512   3.560036 0.4389107
>  2590628     4.065403  0.67835058   3.468860 0.8218848
>  2590619     1.623058  0.07643176   1.946055 0.5335189
>  2590586     1.102444  0.42467133   1.214922 0.5288023
>  2590591     3.842315  0.42584177   2.792450 0.2539151
>  2590645     4.882622  0.75542588   5.073177 0.2141262
>
>  help would be great...
>
>  thanks
>  paul
>
>  @ jim thanks for the hint assign :)
>
>  ______________________________________________
>  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.
>


-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O



More information about the R-help mailing list