2

私はggplot2でこのドットプロットを作成しています:

ggplot(mtcars, aes(x = mpg)) + geom_dotplot()

ドットプロットの上にある観察されたドットに適合するある種の平滑化された密度を表示したいと思います。これは正しくありません:

ggplot(mtcars, aes(x = mpg)) + geom_dotplot() + geom_density()

試しstat_smooth()ましたが、エラーが発生しました:

> ggplot(mtcars, aes(x = mpg)) + geom_dotplot() + stat_smooth()
stat_bindot: binwidth defaulted to range/30. Use 'binwidth = x' to adjust this.
Error: stat_smooth requires the following missing aesthetics: y

ありがとう。

4

2 に答える 2