[R] qplot fill and colour not working as expected

wwreith reith_william at bah.com
Mon Jun 6 15:49:47 CEST 2011


I am just learning to use qplot and can't get the fill/colour to work. Below
is the R code for a scatter plot and bar graph.

library(ggplot2)
x<-c(1,2,3,4,5,6,7)
y<-c(1,2,3,2,5,6,3)
qplot(x,y, main="Scatter Plot Test", xlab="X Label Test", ylab="Y Label
Test", colour="blue")z<-c("van", "van", "van", "car", "car", "truck",
"truck", "truck", "truck", "van", "van")
qplot(z, main="Bar Graph Test", ylab="Vehichle Count", xlab="Vehicle
Category", fill="blue")
If I set fill=z, then I can get something different, i.e. three preselected
colors are used, but what if I want all three bars to just be blue instead
of the default? 

I am having the same issue if I try to use colour. How do I change the
default color to blue instead of black.

Second question what exactly is the difference between colour and fill?  

--
View this message in context: http://r.789695.n4.nabble.com/qplot-fill-and-colour-not-working-as-expected-tp3576949p3576949.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list