How do I show multiple boxplots showing distribution using ggplot

柔情痞子 提交于 2020-02-16 06:48:21

问题


I'm trying to get a graph like this to show boxplot distributions for each age group:

But instead my plot looks like this:

How can I get the boxplots to show rather than the points? Why is my Y axis non numeric?

My data looks like this:

And here's the plot code I am trying:

p2 <- ggplot(data = popSample, aes(x = AGEGRP, y = TOT_POP)) +
  geom_boxplot(aes(group = AGEGRP)) +
  scale_x_discrete() +
  theme_light()
p2

Thank you for helping someone who is learning,

来源:https://stackoverflow.com/questions/60133762/how-do-i-show-multiple-boxplots-showing-distribution-using-ggplot

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!