如何结合两个定性数据以制作条形图
我有采访数据,我想使用 ggplot2 制作条形图。
我的数据结构如下所示:
如何制作条形图,如
- y 轴必须是计数
- x 轴必须是“非常好”, “好”、“不错”、“不好”、“很不好”。
- 每个 x 变量上方应该有两个图表(昨天和今天具有不同颜色)。
- 可选:我可以将每个图表按性别分开吗?
I have data from an interview and I want to make a bargraph using ggplot2.
The structure of my data looks like so:
How do I make a bar graph like
- y axis must be count
- x axis must be "Very good", "Good", "Not bad", "Bad", "Very bad".
- There should be two graphs (Yesterday and Today with differ colour) above each of x variables.
- Optional: Can I seperate each of graphs with gender?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果要制作两个图表昨天和今天在单个GGPLOT中显示(或要在同一绘图中显示两个),则需要包含一个Pivot_longer
示例数据
争吵和绘图
(v2.0.1)
If you want to make two graphs to display Yesterday and Today in a single ggplot (or want to display both in the same plot) you'll need to include a pivot_longer
Example data
Wrangling and plotting
Created on 2022-04-12 by the reprex package (v2.0.1)