Eliminate title on guild

23 views
Skip to first unread message

Troy S

unread,
Jan 24, 2013, 4:38:24 PM1/24/13
to ggplot2
I'm trying to eliminate the word drug in the guide for the following plot.  I read the manual but not having much luck.

set.seed(123)
y=data.frame(t=runif(100, 1, 100), fraction=sort(runif(100)),
  drug=sample(letters[1:2], 100, replace=T))
print(ggplot(y, aes(t, fraction, linetype=drug))
+geom_step()
+scale_x_continuous("Days",limits=c(0,168))
+scale_y_continuous("Percent", limits=c(0,1), labels=percent)
+guides(col=guide_legend(title=NULL))
)

Ben Bond-Lamberty

unread,
Jan 24, 2013, 4:43:13 PM1/24/13
to ggplot2
last_plot()+scale_linetype("")

Ben
> --
> --
> You received this message because you are subscribed to the ggplot2 mailing
> list.
> Please provide a reproducible example:
> https://github.com/hadley/devtools/wiki/Reproducibility
>
> To post: email ggp...@googlegroups.com
> To unsubscribe: email ggplot2+u...@googlegroups.com
> More options: http://groups.google.com/group/ggplot2
>
>
>

pradip...@samhsa.hhs.gov

unread,
Jan 25, 2013, 2:15:04 PM1/25/13
to ggp...@googlegroups.com

Roman Luštrik

unread,
Jan 25, 2013, 2:19:45 PM1/25/13
to pradip...@samhsa.hhs.gov, ggp...@googlegroups.com
Add

labs(linetype = "")

Cheers,
Roman



--
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility
 
To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+u...@googlegroups.com
More options: http://groups.google.com/group/ggplot2
 
 
 



--
In God we trust, all others bring data.

Janesh Devkota

unread,
Jan 25, 2013, 2:26:53 PM1/25/13
to Roman Luštrik, pradip...@samhsa.hhs.gov, Ggplot2
To remove word drug use the following code:

theme(legend.title=element_blank())

This will remove the title of the legend. 

 ggplot(y, aes(t, fraction, linetype=drug))+
      geom_step()+
      scale_x_continuous("Days",limits=c(0,168))+
      scale_y_continuous("Percent", limits=c(0,1))+
      theme(legend.title=element_blank())
  
Thanks. 

Janesh
Reply all
Reply to author
Forward
0 new messages