【发布时间】:2022-08-20 00:14:38
【问题描述】:
我有一个以“状态”作为列之一的数据集。在 status 变量中,数据是“Employed”或“Left.”
我只想可视化 \"Status\" 列的 \"Left\" 条目。
目前,我只能使用以下代码可视化 \"Employed\" 和 \"Left\":
ggplot(data=employee_data) + geom_point(aes(x=satisfaction, y=last_evaluation, color=status))
如果我只想隔离“左”类别中的那些,我该怎么做?
-
data=filter(employee_data, status == \'Left\')? -
data=employee_data[employee_data$Status==\'Left\']? -
嗨@jdobres,感谢您的回复。试过这个,但它不起作用。 ggplot(data=filter(employee_data, status == \"Left\") + geom_point(aes(x=satisfaction, y=last_evaluation, color=status))
-
请添加一个最小示例:stackoverflow.com/questions/5963269/…
-
@NoelJosephPadilla,如果您确实在使用
filter(employee_data, status == \"Left\")并使用ggplot(..., aes(color=status))绘制它,您是说您仍然看到status == \"Employed\"内绘制的点?真的,请在您的问题的代码块中包含示例数据,例如dput(head(employee_data,20))。谢谢!
标签: r ggplot2 data-visualization categorical-data