我有一个如下所示的数据集:
Genre Variabelen Value
1 4am Comedown std_acc 0.253673983
2 4am Comedown std_val 0.230741321
3 4am Comedown std_energy 0.203915405
4 4am Comedown std_danceability 0.185097424
5 4am Comedown std_instrumentalness 0.32926114
6 4am Comedown std_speechiness 0.059602086
我现在要做的是创建每个类型的值的线图,其中x轴包含" variabelen"。所以传说应该包含类型。
对于这个我使用以下行:
library(ggplot)
ggplot(data = df, aes(x=Variabelen, y=Value)) + geom_line(aes(colour=Genre))
然而,这给了我现在的线条以及随后的变暖:
geom_path: Each group consist of only one observation. Do you need to adjust the group aesthetic?
关于我哪里出错的任何想法?
答案 0 :(得分:1)
您需要在aes中使用group=Genre
:
ggplot(data = df, aes(x=Variabelen, y=Value, group=Genre, colour=Genre)) + geom_line()