Barplot does not show bar colors when there're 1000 bars (R language)
bar-chart, r
Solution
It is drawing the color, but it is also drawing a border which is covering up the color. Try
x<-rpois(1000,7)
cols<-c("blue", "red")[(x>10)+1]
barplot(x, col=cols,
main="FO1_FO2 Variant Allele Frequencies",
xlab="SNPs", ylab="VAF(%)",
space=c(0.2, 0.8),
border=NA)
The `border=NA` will disable the drawing of the border.
Problem
One of my CSV files have more than 1000 rows of records, and I want to create a bar plot and color the bars with "blue" or "red", depending on the value of each chart. So I did the following, but I noticed that when I plot the entire CSV file, I don't see any "blue" or "red" bars; however, when I truncate the first 50 rows and did the same plot, I was able to see colored bars. ``` > cols<-c("blue", "red")[(x>10)+1] > barplot(x, col=cols, main="FO1_FO2 Variant Allele Frequencies", xlab="SNPs", ylab="VAF(%)", space=c(0.2, 0.8)) ``` Is there a way to color bars when I have 1000+ bars/rows of data? or is there any better plotting for showing the values and differentiate the differences by color on plot?