# plotting with fading background color

I would like to produce a plot where the background color is not uniform (e.g. all white) but rather changing as function of the slope of the line that is plotted. A concrete example is:

data={{1., 315.457}, {0.997146, 230.976}, {0.988606, 128.556}, {0.974444,74.4523},
{0.954769, 47.2897}, {0.929731, 32.5402},{0.899519,23.8385}, {0.864364, 18.3407},
{0.824533, 14.6737}, {0.78033,12.1217}, {0.732091,10.2853}, {0.680182, 8.92909},
{0.625,7.90752}, {0.566964, 7.12705}, {0.506515, 6.52556}, {0.444114,6.06067},
{0.380236, 5.70282}, {0.315367, 5.43103}, {0.25,5.23019}, {0.184633, 5.08936}}


where I need a white background on the left ($x<0.6$), that fades to red when going to the right ($x=1$). I am struggling on how to achieve it by programming.

• Like this? – J. M. is away Mar 6 '18 at 14:36
• yes! It would be ideal if one could also change the 'slope' of the color gradient. – Luigi Mar 6 '18 at 14:37

You could use DensityPlot[] to generate the background, and Lighter[] + LogisticSigmoid[] for coloring:
DensityPlot[x, {x, 0, 1}, {y, 5, 316}, AspectRatio -> 1/GoldenRatio,

You can tweak the 100 and 0.65 in LogisticSigmoid[100 (# - 0.65)] to adjust the fading.
• Yes; remove the part with Epilog, and do Show[DensityPlot[(* stuff *)], ListPlot[(* stuff *)]]. – J. M. is away Mar 6 '18 at 21:13