嗨,我正在尝试使用ggplot2完成以下任务:
1)将图例名称更改为“资产” 2)在顶部添加标题 3)将每个面板的边框更改为更坚实的深色线条 4)想要更改每个面板图表标题的名称和颜色,例如“公司”等
这是我现在的代码,但我不知道该如何完成。非常感谢帮助。
p <- ggplot(mystratcodes, aes(x=annRisk, y = annRet))
p<- p + facet_grid(. ~ sector) + facet_wrap(~sector)
p<- p + geom_point(size=6, aes(color = (mystratcodes$subsector1)))
p<-p+scale_x_continuous(labels = percent, name = "Annualized Risk")
p<-p+scale_y_continuous(labels = percent, name = "Annualized Return")
p<-p+ theme( legend.position = "bottom", legend.key = element_rect(colour = "grey"))
p<-p + scale_colour_manual(values = c("UTIL" = "#fdcc8a", "IND" = "#fc8d59", "FIN" = "#d7301f","ABS" = "#74a9cf", "CMBS" = "#0570b0", "LA" = "#8c96c6", "SOV"= "#88419d", "SUPRA" = "#b3cde3"))
print(p)
非常感谢
scales::percent
。 - micstr