[R] How to remove legend?

Christoph Krammer ck at altaica.de
Mon Oct 8 13:35:10 CEST 2007


Hello,

I want to do some simple bar plots on email arrival data, but I do not quite
get the point how to remove the legend. I use the following code:

> dow <-
read.csv(file="j:/uni_lernen/da_stockspam/svn/data/c411_weekday.txt",
header=TRUE)
> dow$dayofweek <- factor(dow$dayofweek)
> days <- c("Sun", "Mon", "Tue", "Wed","Thu", "Fri", "Sat")
> levels(dow$dayofweek) <- days
> dow
  dayofweek     c      p w
1       Sun 16477 0.1333 0
2       Mon 19384 0.1568 1
3       Tue 18638 0.1507 1
4       Wed 19747 0.1597 1
5       Thu 20709 0.1675 1
6       Fri 16412 0.1327 1
7       Sat 12283 0.0993 0

> qplot(dayofweek, p, data=dow, geom="bar", xlab="Day", ylab="Arrival Rate",
main="Spam by Weekday", fill=w)

The idea of the w parameter is to give weekends a different color. But when
I do this, I always get a legend of "w" with two entries for its two colors.

How can I avoid this?

Thanks and regards,
 Christoph



More information about the R-help mailing list