Using ggplot2
, I would like color lines "smoothly" in a plot where I have only few datapoints. As is, the scales I tried (e.g. scale_color_gradient2
) do not seem to interpolate colors, but instead color segments monochromatically.
Code example:
ggplot(data.frame(x=1:5)) + geom_line(aes(x=x, y=x, color=x), size=3) +
scale_color_gradient2()