How to create stacked bar chart without the y axis

I want to be able to create a stacked bar chart but I keep getting an error "geom_bar requires the following missing aesthetics: y"


Here is my code:

ggplot(data = wq, aes(x=WHO_Risk_Level,fill=WHO_Risk_Level))+
  geom_bar()

What are you trying to display on the y-axis? The count of those with a given risk level? What do you want stacked? If you're trying to stack these risk levels atop one another, they can't be the x-axis variable, as that will separate them along the x axis.

The x axis is the count of the risk levels. I want to stack the risk levels.

If you specify an x-axis variable (as you have), then they will be separated along the x axis. For a single stacked bar, you should create a dummy variable for the x axis so they aren't separated.

This topic was automatically closed 21 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.