Reputation: 486
how does one get a black outline around the whole bar, and NOT multiple black outlines like in the example plot below:
`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")`
I want the "colour=black" to surround each bar.
Thank you
Upvotes: 0
Views: 594
Reputation: 611
Technically, you do have a black border around each bar. However, for every cut
, you have plenty of bars, one for each value of carat
. If what you want is a black border around each stack of bars, then I would recommend to plot first with a border, and second without border:
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")
Upvotes: 3