user3246152
user3246152

Reputation: 111

R- qplot not changing colors properly

I wanted to start by saying that I've perused the other questions here including the one at this link. I tried pretty much copy/pasting the examples there but I'm still having the issue. I am also pretty new to R in general

FWIW I'm using R studio on ubuntu 13.10 to do this. I have a vector of values 1:8773 or so of square footages of buildings. When I try

qplot(sqFootage, geom = "histogram", colour = "red")

I get this picture :.

enter image description here

Clearly that's not red; it does the same thing for other colors (green, dark green, dodgerblue, firebrickred4) and I'm not sure why.

I've imported the ggplot2 library (or else it wouldn't even show up I guess). Any advice?

Upvotes: 0

Views: 2453

Answers (1)

Sven Hohenstein
Sven Hohenstein

Reputation: 81713

Replace colour with fill:

qplot(sqFootage, geom = "histogram", fill = I("red"))

The parameter colour is used to define the colours of the borders of the rectangles.

Furthermore, you have to use the I function. Otherwise, "red" is interpreted as a factor (as Ben Bolker points out).

Upvotes: 5

Related Questions