Brani Brani - 1 year ago 101
R Question

How can I change the title of a ggplot2 legend?

I was looking here but I can't figure it out.

How can I change the word "type" to something else?

Answer Source


+ labs(colour = "legend title") 

to your ggplot call. Great resource site is also google group for ggplot2.

edit: this assumes that colour is the aesthetic in the legend, e.g. qplot(x,y,colour=z). If another aesthetic is being shown in the legend, use that as the argument instead, e.g. + labs(fill = "legend title") for a raster/image plot.

More generally, if you specify an explicit scale such as scale_colour_continuous, you can set the scale_name argument (warning: the details of the arguments to scales may have changed in recent releases of ggplot2; this description is of version

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download