【发布时间】:2022-11-11 23:25:32
【问题描述】:
“性别”存储为整数:1 和 0 我正在尝试在条形图中将其绘制为 X 轴上的“男性”和“女性” 与赌徒的投注总数相比。
我认为有一种更简单的方法可以做到这一点,而不是将数据集中的每个输入都更改为字符串。
我不是试图给男性一个蓝色和女性紫色或黄色。
谢谢大家
代码:
# scatter plot of age of Gamblers correlated with number of bets
#alpha keeps from over plotting remove if unnecessary
p_1 <- ggplot(data = data, aes(x = Gender, y = BetsA )) +
geom_point(alpha = 0.1)
p_1 + ggtitle(label = "Gender Correlated with Total Number of Bets") + # for the main title
xlab(label = "Gender of Gambler") + # for the x axis label
ylab(label = "Total Number of Bets" ) # for the y axis label
【问题讨论】:
标签: r ggplot2 visualization data-analysis