[英]ggplot2 displaying multiple points for discrete variable
I want to show different countries Index scores on the y axis for a metric column in my dataframe(discrete variable) and color the points based on the country.我想在我的数据框(离散变量)中的度量列的 y 轴上显示不同国家的指数分数,并根据国家/地区为这些点着色。
The snippet of dataframe, test: dataframe的片段,测试:
Countries国家 | Metric公制 | Index Score指数得分 |
---|---|---|
UK英国 | Equity公平 | 99.1 99.1 |
USA美国 | Equity公平 | 6.9 6.9 |
France法国 | Equity公平 | 75.4 75.4 |
ggplot(test,aes( x= Metric , y= "Index Score", color = Countries)) +
geom_point()
The output currently looks like this: all points are on top of each other and not dispersed output目前看起来是这样的:所有点都在彼此之上并且没有分散
Do y = `Index Score`
, a string is not valid.做y = `Index Score`
,字符串无效。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.