Re: [R] Custom manual legend in ggplot2

2015-12-09 Thread Ronaldo Reis Júnior
Hi, Now its work, just invert the theme() and theme_bw() position. The theme_bw() was overlapping the legend position. Thanks Ronaldo Em 09-12-2015 13:11, Ronaldo Reis J�nior escreveu: > Thanks, > > Now its work, but I dont get to change te legend position. Look: > > > ggplot(data1, aes(x=x1, y

Re: [R] Custom manual legend in ggplot2

2015-12-09 Thread Giorgio Garziano
Last "+theme_bw()" to be deleted. Try this: ggplot(data1, aes(x=x1, y=y1))+ geom_point()+ geom_smooth(method="glm", family="gaussian",aes(linetype="equation1"))+ geom_smooth(aes(x=x1, y=y1, linetype="equation2"),data=data2, method="glm", family="gaussian")+ scale_linetype_manual(values =

Re: [R] Custom manual legend in ggplot2

2015-12-09 Thread Ronaldo Reis Júnior
Thanks, Now its work, but I dont get to change te legend position. Look: ggplot(data1, aes(x=x1, y=y1))+ geom_point()+ geom_smooth(method="glm", family="gaussian",aes(linetype="equation1"))+ geom_smooth(aes(x=x1, y=y1, linetype="equation2"),data=data2, method="glm", family="gauss

Re: [R] Custom manual legend in ggplot2

2015-12-09 Thread Giorgio Garziano
Try to look at the link: http://www.cookbook-r.com/Graphs/Legends_(ggplot2)/ Also consider: help(theme) legend.backgroundbackground of legend (element_rect; inherits from rect) legend.margin extra space added around legend (unit) legend.key background underneath legend keys (element_rect

[R] Custom manual legend in ggplot2

2015-12-09 Thread Ronaldo Reis Júnior
Hi, I'm trying to make a ggplot() graph with a custom legend, but without success, it is simple, I have somethink like this in traditional plot: plot(y~x) curve(equation1,lty=1) curve(equation2,lty=2) legend(x,y,legend=c("equation 1","equation 2"),lty=c(1,2),bty="n"). In my ggplot graph I have