【发布时间】:2018-01-11 12:23:32
【问题描述】:
我有以下代码:
librery(ggplot2)
ggplot( mtcars ) +
geom_violin(
aes(
x = factor(cyl),
y = mpg,
fill = factor(cyl)
)
) +
geom_boxplot(
aes(
x = factor(cyl),
y = qsec,
fill = "blue"
),
width = 0.3,
alpha = 0.4
)
生成如下图
情节看起来不错,但我想有不同的传说:
- 4 到 6 只显示颜色
- 'blue' 显示箱线图符号,但没有背景颜色,并带有 图例“箱线图 qsec”
我确信这是可能的(ggplot 一切皆有可能......)但是如何?
【问题讨论】: