为什么我在绘制此图时不会出现我的传奇?
ggplot(data=baseline_total, aes(x=sighd_rater_total, color="sighd_rater_total")) +
geom_area(stat="bin", col = 'light blue', fill='light blue') +
geom_freqpoly(data=baseline_total,aes(x=sighd_tier1_total, color="sighd_tier1_total"), stat = "bin", col = 'dark blue')
答案 0 :(得分:1)
如果您在aes()
内指定颜色(或填充,形状等),则需要在不""
的情况下指定颜色(或填充,形状等),以便根据该变量获取图例。
所以这可能会奏效:
ggplot(data = baseline_total, aes(x = sighd_rater_total, colour = sighd_rater_total)) +
geom_area(stat="bin", colour = "light blue", fill = "light blue") +
geom_freqpoly(data = baseline_total, aes(x = sighd_tier1_total, colour = sighd_tier1_total), stat = "bin")