1

In the following line of code, voc.pca is a princomp object:

plot <- ggbiplot(voc.pca, pc.biplot=TRUE, obs.scale=1,var.scale=1, groups=em$VALENCE) + labs(color="Valence").

I need to display the plot in black and white. So I need to change the 3 legend keys in colours to 3 different shapes, so that in the plot they are readable in black and white.

I've tried this code, but it changes only the shape of the legend markers, but inside the plot the points are all the same.

   plot <- ggbiplot(voc.pca, pc.biplot=TRUE, obs.scale=1,var.scale=1, groups=em$VALENCE) + labs(color="Valence") + guides(colour = guide_legend(override.aes = list(shape=c(3,5,6))))

If someone knows how to do it, I'd appreciate it very much! With many thanks in advance!

c-griffin
  • 2,938
  • 1
  • 18
  • 25
Pauline
  • 11
  • 3

1 Answers1

0

Try adding + geom_point(aes(shape=em$VALENCE), or your list of shapes

Tyson
  • 271
  • 1
  • 2
  • 6
  • Yes it works! Thanks a lot Tyson! Ive also tried to add: + aes (shape=factor (em$VALENCE)), it works but only when the data table has equal numbers of rows and columns. – Pauline Sep 06 '14 at 06:33