Winkel, David wrote: > All, > > > > I have a question regarding colors in bar plots. I want to stack a > total of 18 cost values in each bar. Basically, it is six cost types and > each cost type has three components- direct, indirect, and induced > costs. I would like to use both solid color bars and bars with the > slanted lines (using the density parameter). The colors would > distinguish cost types and the lines would distinguish > direct/indirect/induced. I want the cost types (i.e. colors) to be > stacked together for each cost type. In other words, I don't want all > of the solid bars at the bottom and all of the slanted lines at the top. > > > So far, I have made a bar plot with all solid colors and then tried to > overwrite that bar plot by calling barplot() again and putting the white > slanted lines across the bars. However, I can't get this method to work > while still grouping the cost types together. > > Hi David, This is a real challenge:
heights<-matrix(sample(10:70,54),ncol=3) bar.colors<-rep(rep(2:7,each=3),3) bar.densities<-rep(10,54) bar.angles<-matrix(rep(rep(c(45,90,135),6),3),ncol=3) barplot(heights,col=bar.colors) barplot(heights,angle=bar.angles,add=TRUE,density=bar.densities) 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.