[R] changing "label" in ggplot

Thomthom rime.thomas at gmail.com
Thu Sep 15 17:55:44 CEST 2011


Hi everyone,

I'm trying to create a scatterplot (with ggplot2) with different groups and
a faceting (see code below... much clearer I think)

But when I want to change the color label to something else using the
scale_colour_manual function (based on
http://had.co.nz/ggplot2/scale_manual.html), it seems impossible to get what
I want. Instead I receive a nice error message.

But the code will speak for itself if my request doesn't seem clear enough
to you guys.


Code:


> g<- ggplot(data=d, aes(x=Xcontinuous,y=Ycontinuous) 
+geom_point(aes(colour=d$Groups, shape=d$Groups))
+facet_grid(.~Subgroup)

>g1<-g+ geom_smooth(aes(color=d$Groups), method= "lm", se=FALSE) +
scale_colour_manual(name="Blabla")

When I call g1 then it says: (translating in English... so there may be
differences in the English version)

" Error in names(output_df) <- output:
'names' attribut [1] must have the same length as vector [0]"

I tried to look at the other solutions proposed here or somewhere else but
it seems that nothing like this happens to other people who use this
function...

Any suggestions would be more than welcome! :)

I already thank all of you for your precious help!

Thomas



--
View this message in context: http://r.789695.n4.nabble.com/changing-label-in-ggplot-tp3816015p3816015.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list