[R] ggplot2: geom_smooth and legend

Benoit Boulinguiez benoit.boulinguiez at ensc-rennes.fr
Tue Sep 1 17:58:19 CEST 2009


I cleared out the data frame, I have now one data frame with all the values
in as a function of the experimental condition.

+ successfully mix the linestyle and colour_hue representation of the
geom_smooth though it doesn't look good


NEW CODE
#### 
air_N2_desorb_plot<-ggplot(DATA,aes(Temp,-DrTGA*100,colour=Cond)) +

	geom_smooth(span=0.05,size=1.6,se=F,alpha=0.8) +
	geom_smooth(aes(linetype=Cond),span=0.05,size=1.6,se=F) +

	scale_colour_hue(name="Desorption\n Condition") +
	scale_linetype(name="Desorption\n Condition") +
	
	labs(x=Temp~(degree*C),y=Weight~Derivative~("%/"*degree*C)) +
	opts(panel.grid.minor = theme_line(colour = "grey94"))

print(air_N2_desorb_plot)




Regards/Cordialement


Benoit Boulinguiez 


-----Message d'origine-----
De : r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] De
la part de Benoit Boulinguiez
Envoyé : mardi 1 septembre 2009 17:20
À : r-help at r-project.org
Objet : Re: [R] ggplot2: geom_smooth and legend

Hi!

simple word thank you Hadley!
an answer bringing a new question... is that possible to mix the colour and
linetype representation with geom_smooth()?

I tried the following code, though it hasn't worked.
I have three different datasets due to non even x-axis (Temp) values I guess
I should handle the matter from this point...no?

CODE
#############
air_N2_desorb_plot<-ggplot() +

	geom_smooth(data=DATA.NC60_N2_v1,
	
aes(Temp,-DrTGA*100,colour="N2_v1"),span=0.05,size=1.6,se=F) +
	geom_smooth(data=DATA.NC60_N2_v2,
	
aes(Temp,-DrTGA*100,colour="N2_v2"),span=0.05,size=1.6,se=F) +
	geom_smooth(data=DATA.NC60_air_v1,
	
aes(Temp,-DrTGA*100,colour="Air_v1"),span=0.05,size=1.6,se=F) +

	geom_smooth(data=DATA.NC60_N2_v1,
	
aes(Temp,-DrTGA*100,linetype="N2_v1"),span=0.05,size=1.6,se=F) +
	geom_smooth(data=DATA.NC60_N2_v2,
	
aes(Temp,-DrTGA*100,linetype="N2_v2"),span=0.05,size=1.6,se=F) +
	geom_smooth(data=DATA.NC60_air_v1,
	
aes(Temp,-DrTGA*100,linetype="Air_v1"),span=0.05,size=1.6,se=F) +
	
	scale_colour_hue(name="Desorption\n Condition") +
	
	labs(x=Temp~(degree*C),y=Weight~Derivative~("%/"*degree*C)) +
	opts(panel.grid.minor = theme_line(colour = "grey94"))

print(air_N2_desorb_plot)


Regards/Cordialement


Benoit Boulinguiez 


-----Message d'origine-----
De : hadley wickham [mailto:h.wickham at gmail.com] Envoyé : mercredi 26 août
2009 19:58 À : Benoit Boulinguiez Cc : r-help at r-project.org Objet : Re: [R]
ggplot2: geom_smooth and legend

Hi Benoit,

You could turn the standard errors off with se = F.  Then they'll be removed
from the legend as well.

Hadley

On Tue, Aug 18, 2009 at 7:43 AM, Benoit
Boulinguiez<benoit.boulinguiez at ensc-rennes.fr> wrote:
> Sorry I forgot the code that goes with
>
> ******CODE
> desorb_plot<-ggplot() +
>
>        geom_smooth(data=DATA.B1_SA_N2,
>                        
> aes(Temp,DrTGA*100,colour="B1"),span=0.1,size=1.6) +
>        geom_smooth(data=DATA.FM30K_SA_N2,
>                        
> aes(Temp,DrTGA*100,colour="FM30K"),span=0.2,size=1.6)
> +
>        geom_smooth(data=DATA.NC60_SA_N2,
>                        
> aes(Temp,-DrTGA*100,colour="NC60"),span=0.1,size=1.6)
> +
>        geom_smooth(data=DATA.THC515_SA_N2,
>
>  aes(Temp,DrTGA*100,colour="THC515"),span=0.2,size=1.6) +
>
>        scale_colour_hue(name="Adsorbent") +
>        labs(x=Temp~(degree*C),y=Weight~Derivative~("%/"*degree*C)) +
>        opts(panel.grid.minor = theme_line(colour = "grey94"))
>
> print(desorb_plot)
>
>
> Cordialement / Regards
>
> -------------------------------------------
> Benoit Boulinguiez
> Ecole de Chimie de Rennes (ENSCR) Bureau 1.20 Equipe CIP UMR CNRS 6226 
> "Sciences Chimiques de Rennes"
> Avenue du Général Leclerc
> CS 50837
> 35708 Rennes CEDEX 7
> Tel 33 (0)2 23 23 80 83
> Fax 33 (0)2 23 23 81 20
> http://www.ensc-rennes.fr/
>
>
> Quoting Benoit Boulinguiez <benoit.boulinguiez at ensc-rennes.fr>:
>
>> Hi all,
>>
>> Is that possible to remove the grey colour in the legend key that 
>> goes with the geom_smooth? In my case it doesn't ease the reading of 
>> the legend.
>>
>> http://www.4shared.com/file/125864977/e10644f8/desorb.html
>>
>>
>> Cordialement / Regards
>>
>> -------------------------------------------
>> Benoit Boulinguiez
>> Ecole de Chimie de Rennes (ENSCR) Bureau 1.20 Equipe CIP UMR CNRS
>> 6226 "Sciences Chimiques de Rennes"
>> Avenue du Général Leclerc
>> CS 50837
>> 35708 Rennes CEDEX 7
>> Tel 33 (0)2 23 23 80 83
>> Fax 33 (0)2 23 23 81 20
>> http://www.ensc-rennes.fr/
>
> ______________________________________________
> 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.
>



--
http://had.co.nz/

______________________________________________
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