[R] barplot fill patterns
Hector L. Ayala-del-Rio
ayalahec at msu.edu
Mon Apr 19 05:28:09 CEST 2004
Dear R-helpers,
I will like to know if there is a way to generate a stacked column
graph using both patterns and colors to fill the bars. I have many
categories for the number of color available in R, so I will like R to
start with solid colors and then use patterns an colors. I have been
using barplot and some code that I found in the archives, but I am
still having bars with the exact same color and patterns even though
they belong to different categories. How many different colors are
available in R?? I know it is a silly question but I have looked
everywhere and I can not find it. I have also tried to add the legend,
with the difficulty that overlaps with the plot. Does anybody know how
to adjust the size of the graph and the legend so they can fit in the
same page??? Below is how part of the data looks and the code I have
been using. Any suggestions are welcome
thanks
Hector
>barplot(t(Control.cfo.norm.mat),beside=F,space=.3,legend.text=colnames(
Control.cfo.norm.mat),col=(0:100),las=3,
density=rep(c(85,55,-1),5),angle=rep(c(45,90,180),5))
>Control.cfo.norm.mat
X36 X40 X58 X60 X62
X66
26Y 0.000000000 0.000000000 0.000000000 0.005409866 0.084265542
0.03218412
C-50 0.000000000 0.000000000 0.000000000 0.019747309 0.096583996
0.15919513
C-90 0.005584642 0.000000000 0.005671902 0.022687609 0.067102967
0.07643979
C-127-1 0.000000000 0.000000000 0.011776706 0.013816766 0.033753709
0.36999258
C-164 0.000000000 0.000000000 0.000000000 0.009163186 0.024120738
0.31976823
C-198 0.000000000 0.000000000 0.000000000 0.009708738 0.035671430
0.15904876
C-226 0.000000000 0.000000000 0.000000000 0.000000000 0.019187779
0.07991803
C-268 0.000000000 0.000000000 0.000000000 0.008017960 0.028864657
0.06724396
C-294-C 0.004623288 0.000000000 0.000000000 0.009589041 0.032448630
0.06446918
C-310 0.000000000 0.000000000 0.000000000 0.000000000 0.010871603
0.02858482
C-357-2 0.008525755 0.000000000 0.000000000 0.039520426 0.017850799
0.03596803
C-375 0.007081596 0.000000000 0.004406326 0.018176096 0.030293493
0.06428515
C-399 0.008050940 0.000000000 0.003659518 0.041206177 0.077581790
0.09104882
C-414 0.008423269 0.000000000 0.000000000 0.025927876 0.053698342
0.10858121
C-428 0.004066090 0.000000000 0.000000000 0.005163289 0.006454111
0.04485607
C-434 0.000000000 0.000000000 0.000000000 0.014529545 0.014097440
0.09122826
C-454 0.006096595 0.000000000 0.000000000 0.020348377 0.013460016
0.07624703
C-465 0.000000000 0.000000000 0.000000000 0.029669076 0.051477114
0.10904019
C-479 0.007429222 0.000000000 0.000000000 0.023358544 0.019878188
0.10293822
C-525 0.005839724 0.000000000 0.000000000 0.010835151 0.009990853
0.05832688
C-532 0.000000000 0.000000000 0.000000000 0.018876507 0.018876507
0.05390039
C-541 0.006378889 0.000000000 0.000000000 0.010660608 0.000000000
0.03416637
C-567 0.000000000 0.000000000 0.000000000 0.018852788 0.022763738
0.12996390
C-605 0.000000000 0.000000000 0.000000000 0.015993146 0.120234185
0.14065400
C-616 0.009669768 0.000000000 0.000000000 0.014960774 0.035668674
0.05893085
C-630-1 0.011308562 0.000000000 0.000000000 0.008885299 0.162493269
0.04671513
C-630-2 0.008951265 0.000000000 0.000000000 0.007514643 0.133384904
0.04099900
C-667 0.005172106 0.000000000 0.000000000 0.016229713 0.087836633
0.14071696
C-687 0.010054618 0.000000000 0.009309831 0.027681231 0.241559086
0.16335650
C-694 0.011289799 0.004304743 0.012264457 0.032163743 0.235298895
0.16902209
C-722 0.007263246 0.000000000 0.000000000 0.010429276 0.085203464
0.06453115
C-729 0.012428930 0.000000000 0.000000000 0.012693376 0.218960730
0.09956366
C-750 0.011836777 0.000000000 0.000000000 0.020558613 0.121378881
0.11535666
C-811 0.000000000 0.000000000 0.000000000 0.013054830 0.019938286
0.15475908
X77 X92 X95 X96 X107
X109
26Y 0.011736659 0.000000000 0.009536035 0.019622226 0.000000000
0.000000000
C-50 0.004679457 0.000000000 0.005053814 0.005240992 0.000000000
0.000000000
C-90 0.000000000 0.000000000 0.007591623 0.000000000 0.000000000
0.007940663
Héctor L. Ayala-del-Río, Ph.D.
Center for Microbial Ecology &
Center for Genomic and Evolutionary Studies
on Microbial Life at Low Temperatures
Michigan State University
545 Plant & Soil Sciences Building
East Lansing, MI 48824-1325
Phone: 517-353-9021
Fax: 517-353-2917
More information about the R-help
mailing list