更改圖例標題並增加金鑰大小

# load the library
library(ggplot2)

# create a blank canvas
g <- ggplot(data = diamonds)

g + geom_bar(aes(x = cut, fill = cut)) + 
    scale_fill_discrete(guide = guide_legend(title = "CUT", 
                                             keywidth = 2, 
                                             keyheight = 2))

https://i.stack.imgur.com/cRPmB.jpg