[R] How to remove legend?
Christoph Krammer
ck at altaica.de
Mon Oct 8 14:35:18 CEST 2007
Hello Thierry,
thanks for your fast response.
This does what I want, thank you.
Where can I get more documentation for this scale_fill_continuous() method
and similar ones? I figured out how to choose the colors but I don't quite
get how to add a solid border to the bars.
Regards,
Christoph
-----Original Message-----
From: ONKELINX, Thierry [mailto:Thierry.ONKELINX at inbo.be]
Sent: Monday, October 08, 2007 1:47 PM
To: Christoph Krammer; r-help at r-project.org
Subject: RE: [R] How to remove legend?
Try somelike this
library(ggplot2)
dow <- data.frame(dayofweek = factor(1:7), p = runif(7), w = c(0, 1, 1,
1, 1, 1, 0))
sc <- scale_fill_continuous()
sc$legend <- FALSE
qplot(dayofweek, p, data=dow, geom="bar", xlab="Day", ylab="Arrival
Rate", main="Spam by Weekday", fill=w) + sc
HTH,
Thierry
------------------------------------------------------------------------
----
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
methodology and quality assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium
tel. + 32 54/436 185
Thierry.Onkelinx at inbo.be
www.inbo.be
Do not put your faith in what statistics say until you have carefully
considered what they do not say. ~William W. Watt
A statistical analysis, properly conducted, is a delicate dissection of
uncertainties, a surgery of suppositions. ~M.J.Moroney
> -----Oorspronkelijk bericht-----
> Van: r-help-bounces at r-project.org
> [mailto:r-help-bounces at r-project.org] Namens Christoph Krammer
> Verzonden: maandag 8 oktober 2007 13:35
> Aan: r-help at r-project.org
> Onderwerp: [R] How to remove legend?
>
> 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
>
> ______________________________________________
> 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.
>
More information about the R-help
mailing list