I'm looking to add "n = #" under each of the variables on the x-axis but I'm not sure how. The counts don't necessarily have to be under the names, just as long as the counts are there. I'm also working with two categorical variables, so that may be the issue too. Let me know if you have any suggestions, I'm new to R.
~
Here's some information on the dataset and the variables I'm comparing. The overall data set (scorpions) consists of scorpion species and what vegetation they're found in. Those are the two things I'm comparing. "species" is the vector for the species and "veg" is the vector for the vegetation type. These are both character vectors. I really just want to know how to add more labels onto my graph to give more clarification. This is what my graph currently looks like: graph
I just want to be able to add number labels anywhere. If you want to recreate it, you can really use any dataset that consists of two character vectors. The other posts don't help because they consist of numerical vectors as well. If it's not possible to do this, then just let me know.
Thank you everyone for the help so far!
ggplot(data=scorpions, aes(x=species,y=veg,fill=veg)) +
geom_bar(stat="identity",color="black",position=position_dodge()) +
theme_stata() +
scale_fill_economist() +
theme(
axis.text.y = element_text(angle = 0),
axis.title = element_text(face="bold"),
axis.text.x = element_text(face = "italic")
) +
labs(title="Relationship Between Species and Vegetation Type")
I've tried changing the names in the Excel spreadsheet, but it looks really messy. I've also tried googling answers but nothing works since it's two categorical variables.