私は3つの折れ線グラフのファセットプロットを作成しようとしています。私は "oirf"に対応する行を実線にしたいと思います。また、 "upperCI"と "lowerCI"に対応する両方の行は破線で表示されます。 :ggplotエラー:3つの変数の折れ線グラフを作成し、それらのファセットプロットを作成します。
しかし、私は解決できないエラーを取得しています。
"countrySpellId","iso","country","step","indicator","vals"
38,"BLR","Belarus",0,"oirf",-0.19979745478058
38,"BLR","Belarus",1,"oirf",-0.182586795026907
38,"BLR","Belarus",2,"oirf",-0.242312010909111
106,"GEO","Georgia",0,"oirf",-0.154580915298088
106,"GEO","Georgia",1,"oirf",-0.0572862343086547
106,"GEO","Georgia",2,"oirf",-0.345457860190889
167,"KGZ","Kyrgyzstan",0,"oirf",0.960777168532119
167,"KGZ","Kyrgyzstan",1,"oirf",0.458003383067036
167,"KGZ","Kyrgyzstan",2,"oirf",0.190725669245905
38,"BLR","Belarus",0,"lowerCI",-0.357909781851253
38,"BLR","Belarus",1,"lowerCI",-0.411483619567094
38,"BLR","Belarus",2,"lowerCI",-0.514508124910321
106,"GEO","Georgia",0,"lowerCI",-0.323219475085121
106,"GEO","Georgia",1,"lowerCI",-0.236286319570866
106,"GEO","Georgia",2,"lowerCI",-0.540228716700013
167,"KGZ","Kyrgyzstan",0,"lowerCI",0.448913075973564
167,"KGZ","Kyrgyzstan",1,"lowerCI",0.0581860926615476
167,"KGZ","Kyrgyzstan",2,"lowerCI",-0.235580302805703
38,"BLR","Belarus",0,"upperCI",-0.0416851277099078
38,"BLR","Belarus",1,"upperCI",0.0463100295132811
38,"BLR","Belarus",2,"upperCI",0.0298841030920997
106,"GEO","Georgia",0,"upperCI",0.0140576444889454
106,"GEO","Georgia",1,"upperCI",0.121713850953557
106,"GEO","Georgia",2,"upperCI",-0.150687003681766
167,"KGZ","Kyrgyzstan",0,"upperCI",1.47264126109067
167,"KGZ","Kyrgyzstan",1,"upperCI",0.857820673472524
167,"KGZ","Kyrgyzstan",2,"upperCI",0.617031641297513
は、ここで私はプロットをやろうとしている方法は次のとおりです:
ggplot(data = oirfsFacetPlot2, aes(x = step, y = vals, group = countrySpellId,
stat = "identity")) +
geom_line(aes(linetype = indicator)) +
xlab("Month") + ylab("Percent change") +
theme_bw() + scale_x_continuous(breaks = seq(0,3,1)) +
scale_linetype_discrete(name ="indicator",
breaks=c("lowerCI", "oirf","upperCI")) +
facet_wrap(~ country, scales = "free_y", nrow = 3)
をしかし、私は何とか私が思うaes(linetype = indicator)
に関連して、このエラーを取得
は、ここに私のデータです。
Error: geom_path: If you are using dotted or dashed lines, colour, size and linetype must be constant over the line
私は間違っていますか?
画像は、あなたがそれでいる間 –
があなたの 'aes'(と' stat'から 'group'を削除するまで表示されません)。 –