2016-07-28 21 views

Antwort

1

Sie können Ihr Problem Führer mit loszuwerden() und Titelposition angeben.

library(ggplot2) 
xy <- data.frame(x=1:10, y=10:1, type = rep(LETTERS[1:2], each=5)) 

plot <- ggplot(data = xy)+ geom_point(aes(x = x, y = y, color=type)) + 
     theme(legend.position = 'bottom') + 
     guides(colour = guide_legend(title.position = "top")) 

plot 

zwar alt ist, bemerkte ich, dass diese Antwort Legend title position in ggplot2 gut noch ist, auch wenn ggplot2 jetzt über 0,9 viele Versionen ist. Mir ist aufgefallen, dass der Aufruf zur Bibliothek (Waagen) nicht mehr nötig ist. Hoffe, das hilft

+0

Danke! Ich wusste, wie man es mit Opts macht, was für eine Weile veraltet ist. Ich konnte nicht herausfinden, dass die Positionierung innerhalb der Farbe festgelegt ist –