在加权geom_density中更改组的顺序

时间:2016-12-21 10:52:39

标签: r ggplot2 density-plot

鉴于以下示例,我想按大小重新排列密度,以便最大区域(“理想”组)在后面和最小区域(<组< em>“fair”)在前面。这将有助于解释,特别是如果区域大小变化很大。

ggplot(diamonds, aes(depth, fill = cut, colour = cut, weight=price)) +
  geom_density(alpha = 0.5) +
  xlim(55, 70)

enter image description here

0 个答案:

没有答案