是否可以更改 ggplot2 中 scale_size 中项目的默认颜色?
Is it possible to change the default color of the items in scale_size in ggplot2?
我想更改 ggplot2
中 scale_size_manual()
的默认颜色,而不受数据帧中数据类型的影响。
这可能吗?
例如,我希望尺码图例中的所有商品都是颜色 "red"
。
试试这个:
> p <- ggplot(mtcars,aes(x = mpg,y = disp,size = cyl)) + geom_point()
> p + scale_size_continuous(guide = guide_legend(override.aes = list(colour = "red")))
奇怪的是,override.aes
似乎不喜欢 color
的美式拼写。可能需要追踪并提交一个小补丁...
我想更改 ggplot2
中 scale_size_manual()
的默认颜色,而不受数据帧中数据类型的影响。
这可能吗?
例如,我希望尺码图例中的所有商品都是颜色 "red"
。
试试这个:
> p <- ggplot(mtcars,aes(x = mpg,y = disp,size = cyl)) + geom_point()
> p + scale_size_continuous(guide = guide_legend(override.aes = list(colour = "red")))
奇怪的是,override.aes
似乎不喜欢 color
的美式拼写。可能需要追踪并提交一个小补丁...