[R] qplot fill and colour not working as expected

Jonathan Daily biomathjdaily at gmail.com
Mon Jun 6 16:50:56 CEST 2011


One difference between colour and fill can be demonstrated by
specifying both with different values. In cases where a polygon is
filled, colour specifies border line color.

On Mon, Jun 6, 2011 at 9:49 AM, wwreith <reith_william at bah.com> wrote:
> 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.
>
> ______________________________________________
> R-help at 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.
>



-- 
===============================================
Jon Daily
Technician
===============================================
#!/usr/bin/env outside
# It's great, trust me.



More information about the R-help mailing list