1

I'm having trouble manipulating ggbiplot such that I can specify what the title of the legend is. Using the package data:

library(ggbiplot) data(wine) wine.pca <- prcomp(wine, scale. = TRUE) p <- ggbiplot(wine.pca, obs.scale = 1, var.scale = 1, groups = wine.class, ellipse = TRUE, circle = TRUE) 

I've tried the following

p + scale_fill_discrete(name="New Title") p + guides(fill=guide_legend(title="New Legend Title")) 

but I have no luck with either. I was wondering if somebody was familiar with this package and was able to advise as to how to change the legend title.

2 Answers 2

6

As you are plotting points and their aesthetics is color and accordingly you should use color= instead of fill=

p+guides(color=guide_legend("Legend title")) 

or

p + labs(color="Legend title") 
Sign up to request clarification or add additional context in comments.

Comments

1

In the meantime it works with scale_color_discrete(name = 'Legend title').

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.