Hi Arthur:
# Just move size outside 'aes' like this:
p <- ggplot(df1, aes(Year, PctProf, group = Group))
p + geom_line(aes(color = Group),size=1)

# to make the background white just use the black and white theme:
p <- ggplot(df1, aes(Year, PctProf, group = Group))
p + geom_line(aes(color = Group),size=1) + theme_bw()

Felipe D. Carrillo  
Supervisory Fishery Biologist  
Department of the Interior  
US Fish & Wildlife Service  
California, USA


--- On Fri, 4/17/09, Arthur Burke <bur...@nwrel.org> wrote:

> From: Arthur Burke <bur...@nwrel.org>
> Subject: Mischief on legend when size=1 added to geom_line
> To: ggpl...@googlegroups.com
> Date: Friday, April 17, 2009, 3:11 PM
> I have a data frame consisting of a group ID, year, and
> percent of
> students proficient on a state test.
>  
> df1 <- 
>  
>       Group Year PctProf
> 1  Never RF 2004      87
> 2  Cohort 1 2004      83
> 3  Cohort 2 2004      84
> 4  Cohort 3 2004      87
> 5  Cohort 4 2004      73
> 6  Never RF 2005      85
> 7  Cohort 1 2005      81
> 8  Cohort 2 2005      81
> 9  Cohort 3 2005      78
> 10 Cohort 4 2005      72
> 11 Never RF 2006      83
> 12 Cohort 1 2006      78
> 13 Cohort 2 2006      78
> 14 Cohort 3 2006      70
> 15 Cohort 4 2006      80
> 16 Never RF 2007      82
> 17 Cohort 1 2007      75
> 18 Cohort 2 2007      73
> 19 Cohort 3 2007      79
> 20 Cohort 4 2007      75
> 21 Never RF 2008      83
> 22 Cohort 1 2008      81
> 23 Cohort 2 2008      81
> 24 Cohort 3 2008      76
> 25 Cohort 4 2008      62
>  
> I am interested in a plot of percent proficient by group
> across time, so
> ...
>  
> p <- ggplot(df1, aes(Year, PctProf, group = Group))
> p + geom_line(aes(color = Group))
> 
> ... creates the plot nicely.
>  
> However, adding the size=1 parameter results in the legend
> showing a "1"
> and a line color for 1, as well as "Group" and
> the line colors for the
> groups.
>  
> p <- ggplot(df1, aes(Year, PctProf, group = Group))
> p + geom_line(aes(color = Group, size=1))
> 
> I can run the plot with the default size for line of
> course, but I do
> want to thicken the lines a bit. Can someone help me out
> with that? 
>  
> Secondly, how do I set the background to clear?
>  
> Thanks!
> Art
> 
> ------------------------------------------------------------------
> 
> Art Burke
> Northwest Regional Educational Laboratory
> 101 SW Main St, Suite 500
> Portland, OR 97204-3213
> 
> Phone:  503-275-9592 / 800-547-6339
> 
> Fax: 503-275-0450
> 
> bur...@nwrel.org 
> 
>  
> 
> 
>   
> 
> 
> --~--~---------~--~----~------------~-------~--~----~
> You received this message because you are subscribed to the
> ggplot2 mailing list.
> To post to this group, send email to
> ggpl...@googlegroups.com
> To unsubscribe from this group, send email to
> ggplot2+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/ggplot2
> -~----------~----~----~----~------~----~------~--~---

______________________________________________
R-help@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.

Reply via email to