图例在ggplot2中意外更改

时间:2017-06-04 21:20:08

标签: r ggplot2 legend

知道为什么会这样吗?颠倒图例的顺序会大大改变它。

ggplot(mtcars, aes(x = disp, y = mpg, colour = disp, size = disp)) +
  geom_point() +
  scale_colour_distiller(palette = "PuOr") + 
  guides(size = FALSE)

ggplot(mtcars, aes(x = disp, y = mpg, colour = disp, size = disp)) +
  geom_point() +
  scale_colour_distiller(palette = "PuOr") + 
  guides(size = FALSE, colour = guide_legend(reverse = TRUE))

0 个答案:

没有答案