Does anybody know why my bars are not displaying colors? Thank you!
ggplot(data = class_survey, aes(x = coding_exp_words, fill = coding_exp_words)) +
geom_bar() +
scale_fill_manual(values = c("Some" = "red",
"None" = "blue",
"Very little" = "purple",
"A bit" = "green",
"A good deal" = "black")) +
theme(axis.ticks.x = element_blank(),
axis.text.x = element_blank())
denfly
February 4, 2022, 9:15am
2
Perhaps the following, not knowing your data set but it seems there are 6 bars, and you are defining 5 colors. traceback() may also give you some info on the error. Also, if the names are correct and in order that you wanted, you don't need to specify these, only the colors.
Hi @JustAstudent , try with this, and remember put in other occasion the example data, dput()
form make reproducible example.
The colors is well like said @denfly .
ggplot(data = class_survey, aes(x = coding_exp_words, fill = coding_exp_words)) +
geom_bar(stat="identity", position="dodge") +
scale_fill_manual(values = c( "red", "blue", "purple", "green", "black", "cyan")) +
theme(axis.ticks.x = element_blank(),
axis.text.x = element_blank())
system
Closed
February 15, 2022, 6:02am
4
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed. If you have a query related to it or one of the replies, start a new topic and refer back with a link.