Using ggplot2 , I would like the colored lines to be โsmoothlyโ on the graph, where I only have a few data points left. As with the scaling I tried (e.g. scale_color_gradient2 ), it seems not to interpolate the colors, but instead the color segments are monochromatic.
Code example:
ggplot(data.frame(x=1:5)) + geom_line(aes(x=x, y=x, color=x), size=3) + scale_color_gradient2()

source share