2015-11-13 5 views
6

ggplotの塗りの凡例からカラーラインを削除したい。私は通常、伝説の美学を変更するのにguide_legend(override.aes = ...)を使用します - 点、線、アルファなどのためにはうまくいきますが、私のcolor審美的には機能しません。私は間違って何をしていますか?凡例の色を変更するのにoverride.aesを使用できないのはなぜですか?

# generate data 
set.seed(47) 
data = data.frame(year = rep(2000:2004, 3), 
        value = runif(15), 
        group = rep(c("A", "B", "C"), each = 5)) 

# create the plot 
p = ggplot(data, aes(x = year, y = value, fill = group)) + 
    geom_area(position = position_fill(), color = "white") + 
    scale_fill_grey() 

# this should modify the fill legend to remove the colored line 
# but the line is still there 
p + guides(fill = guide_legend(override.aes = list(color = NA))) 

enter image description here

答えて

8

これはcolouruで綴られなければならない例です。

p + guides(fill = guide_legend(override.aes = list(colour = NA))) 

enter image description here

+1

それはDEVバージョンですでに変更されています:uを追加するとうまくoverride.aes作業を行います。 – joran

+2

"ggplout2" -hadley – rawr

+0

私は[私の一見単純な答え](http://stackoverflow.com/questions/28694969/add-separate-legend-for-home)を書いたときに、この問題に関して私の机の上で私の頭を強く叩いていました。 geom-vline/28696738#28696738)once ... – Henrik

関連する問題