勾勒出geom_bar的整个条形图
如何获得整个条的黑色轮廓,而不是下面示例图中的多个黑色轮廓:勾勒出geom_bar的整个条形图,r,ggplot2,colors,geom-bar,R,Ggplot2,Colors,Geom Bar,如何获得整个条的黑色轮廓,而不是下面示例图中的多个黑色轮廓: `diamonds %>% select(carat, cut) %>% distinct() %>% ggplot() + geom_bar(aes(x=factor(cut), y=factor(carat), fill=factor(carat)), stat = "identity", colour="black") + theme(legend.position = "none")` 我
`diamonds %>%
select(carat, cut) %>%
distinct() %>%
ggplot() +
geom_bar(aes(x=factor(cut), y=factor(carat), fill=factor(carat)),
stat = "identity", colour="black") +
theme(legend.position = "none")`
我想让“颜色=黑色”环绕每个酒吧
谢谢从技术上讲,每个酒吧周围都有黑色边框。但是,对于每一次
切割
,都有很多条,每克拉的值对应一条。如果您想要的是在每一堆条的周围有一个黑色边框,那么我建议您首先绘制一个边框,然后绘制第二个没有边框:
diamonds %>%
select(carat, cut) %>%
distinct() %>%
ggplot() +
geom_bar(aes(x=factor(cut), y=factor(carat)),
stat = "identity", color = "black", size = 1) +
geom_bar(aes(x=factor(cut), y=factor(carat), fill=factor(carat)),
stat = "identity") +
theme(legend.position = "none")
给出:
从技术上讲,每个栏的周围都有一个黑色边框。但是,对于每一次切割
,都有很多条,每克拉的值对应一条。如果您想要的是在每一堆条的周围有一个黑色边框,那么我建议您首先绘制一个边框,然后绘制第二个没有边框:
diamonds %>%
select(carat, cut) %>%
distinct() %>%
ggplot() +
geom_bar(aes(x=factor(cut), y=factor(carat)),
stat = "identity", color = "black", size = 1) +
geom_bar(aes(x=factor(cut), y=factor(carat), fill=factor(carat)),
stat = "identity") +
theme(legend.position = "none")
给出: