-----Original Message-----
From: friendly at yorku.ca
Sent: Fri, 08 Mar 2013 11:36:36 -0500
To: r-help at r-project.org
Subject: [R] ggplot2: modifying line width and background fill color for
stat_smooth()
In the example below, from
http://www.ling.upenn.edu/~joseff/rstudy/summer2010_ggplot2_intro.html
I'd like to make (a) the fitted line thicker and (b) change the
background fill color for the confidence
envelope around each fitted line to a low-alpha transparent version of
the same color used
for the separate fitted lines for GENDER, rather than grey for both.
How can I do this?
donner<-read.csv("http://www.ling.upenn.edu/~joseff/data/donner.csv")
ggplot(donner, aes(AGE, NFATE, color = GENDER))+
geom_point(position = position_jitter(height = 0.02, width = 0)) +
stat_smooth(method = "glm", family = binomial, formula = y ~
poly(x,2))
For the line width, I tried,
ggplot(donner, aes(AGE, NFATE, color = GENDER))+
geom_point(position = position_jitter(height = 0.02, width = 0)) +
stat_smooth(aes(size=2), method = "glm", family = binomial, formula =
y ~ poly(x,2))
This worked, but gave a spurious component labeled "2" in the plot
legend.
TIA,
-Michael
--
Michael Friendly Email: friendly AT yorku DOT ca
Professor, Psychology Dept. & Chair, Quantitative Methods
York University Voice: 416 736-2100 x66249 Fax: 416 736-5814
4700 Keele Street Web: http://www.datavis.ca
Toronto, ONT M3J 1P3 CANADA
[[alternative HTML version deleted]]