Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
を使用してggplot2、データポイントがほとんどないプロットで「スムーズに」色の線を表示したいと思います。そのままでは、私が試したスケール (例: scale_color_gradient2) は色を補間していないように見えますが、代わりに単色でセグメントに色を付けています。
ggplot2
scale_color_gradient2
コード例:
ggplot(data.frame(x=1:5)) + geom_line(aes(x=x, y=x, color=x), size=3) + scale_color_gradient2()
1 から 5 の間でポイントの量を増やすことができます。
df <- data.frame(x=seq(1,5,0.001)) ggplot(df) + geom_line(aes(x=x, y=x, color=x), size=3) + scale_color_gradient2()