How does one efficiently produce a plot of {f[x], f[x]+1}? Assume that f[x] is a long computation, which I would like to avoid doing twice.
For example:
f = (Pause[.01]; #)&
Plot[f[x], {x, 0, 1}]
Plot[{f[x], f[x]+1}, {x, 0, 1}]
The second plot takes twice as long as the first plot to render, whereas it could be done in about the same amount of time if f[x] was memoized appropriately.


f(just likePlotdoes)? (ListLinePlot/ListPlot+Joined -> Truedoes not do that.) – Michael E2 Feb 01 '15 at 20:47Plot[{#, #+1}& @ f[x], {x, 0, 1}]is accepted here. That however doesn't style lines separately. Therefore... – Mr.Wizard Feb 02 '15 at 01:11