[R] barplot: different colors for the bar and the strips
Hi, I am using barplot and would like to know if it is possible to have bars filled with one color while use a different color for the shading lines. The following code colors the shading lines, leaving the bars in white: barplot(1:5, col=c(1:5), density=c(1:5)*5) while the colors are applied to the bars when density is removed. barplot(1:5, col=c(1:5)) I did check ?barplot and found the following: col: a vector of colors for the bars or bar components. Thanks, Hao -- __ R-help@stat.math.ethz.ch 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.
Re: [R] barplot: different colors for the bar and the strips
Hello Marc Schwartz On Thu, Sep 07, 2006 at 07:54:05AM -0500, Marc Schwartz wrote: On Thu, 2006-09-07 at 06:18 -0500, Hao Chen wrote: Hi, I am using barplot and would like to know if it is possible to have bars filled with one color while use a different color for the shading lines. The following code colors the shading lines, leaving the bars in white: barplot(1:5, col=c(1:5), density=c(1:5)*5) while the colors are applied to the bars when density is removed. barplot(1:5, col=c(1:5)) I did check ?barplot and found the following: col: a vector of colors for the bars or bar components. Thanks, Hao Note the key word 'or' in the description of the 'col' argument. You need to make two separate calls to barplot(). The first using the fill colors, then the second using the shading lines AND setting 'add = TRUE', so that the second plot overwrites the first without clearing the plot device. barplot(1:5, col=c(1:5)) barplot(1:5, col = black, density=c(1:5), add = TRUE) Just be sure that any other arguments, such as axis limits, are identical between the two calls. HTH, Marc Schwartz Thank you very much for your help. It works but only in the order as you put it, since the following code only shows the color, but not the shading lines: barplot(1:5, col = black, density=c(1:5)) barplot(1:5, col=c(1:5), add = TRUE) Hao Chen --- Mining PubMed: http://www.chilibot.net - __ R-help@stat.math.ethz.ch 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.
Re: [R] Automatic creation of file names
On Thu, Sep 22, 2005 at 10:21:06AM -0400, Leite,Walter wrote: Dear R-Help members, I have a question about how to save to the hard drive the one thousand datasets I generated in a simulation. The datasets are created in a for loop that repeatedly creates normally distributed datasets, such as the example below: Library(MASS) for (number in 1:1000) { dataset = mvrnorm(n = 400, mu = c(0,0,0), Sigma = matrix(c(1,0.3,0.3,0.3,1,0.3,0.3,0.3,1),3,3)) } I don't know how to write the datasets with different names to the hard drive. I have solved the problem before by creating a list of names (file1.txt, file2.txt,file3.txt, etc...) in Microsoft Excel, reading it to R with read.table, and using write.table to write each file with the name I created in Excel. I want to know if it is possible to create a list of file names automatically within R to save the datasets created in my simulation. paste(file, 1:1000, .txt, sep=) Thank you for your help, Walter L. Leite __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- - : Hao Chen, Ph.D. : Instructor : Department of Pharmacology : University of Tennessee Health Science Center : Memphis, TN 38163 USA : Office: 901 448 3201 : Mobil: 901 826 1845 Mining PubMed: http://www.chilibot.net - __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] win.metafile on linux?
Dear R-help, Is it possible to use win.metafile() on *nix versions of R? I tried R 2.1.1 on FreeBSD and R 1.9.0 on redhat with no success. I need to give some graphs generated in R to my boss so that he can modify them in Powerpoint to fit he style of his presentation. Recommendations on other methods are appreciated as well. Hao -- : Hao Chen, Ph.D. : Instructor : Department of Pharmacology : University of Tennessee Health Science Center : Memphis, TN 38163 USA : Office: 901 448 3201 : Mobil: 901 826 1845 : Mining PubMed: http://www.chilibot.net : -- __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html