使用时有没有办法在图例中同时显示大小和颜色geom_point
?
library(ggplot2)
cons2 <- data.frame(
value_date = as.Date(c('2013-04-30', '2013-04-30', '2013-06-13', '2013-06-13')),
ticker = c('AAPL','FTW','AAPL','FTW'),
discount = c(0.34,0.10,0.25,0.20),
b = c(0.40,0.55,.60,0.90),
yield = c(0.08,0.04, 0.06,0.03)
)
p <- ggplot(cons2)
p <- p + geom_point(aes(yield,b, size = discount, color=value_date))
p
该图将仅在图例中显示尺寸(折扣),但我想同时显示尺寸(折扣)和颜色(值日期)。