2011-10-02 43 views

回答

9

這裏是一個選項legend.key.width

# sample data frame 
df <- data.frame(x = c(rnorm(100, -3), rnorm(100), rnorm(100, 3)), 
       g = gl(3, 100)) 
df <- ddply(df, .(g), summarize, x = x, y = ecdf(x)(x)) 

ggplot(df, aes(x, y, colour = g, linetype = g)) + 
    geom_line() + 
    theme(legend.key.width = unit(10, "line")) 

enter image description here

+0

+1哇!驚人!!!太感謝了 :) – Legend

0

opts沒有與GGPLOT2工作。你需要使用theme,所以你需要輸入:

+ theme(legend.key.width = unit(10, "line")) 
相關問題