I have a data set of x,y values in a file called values.txt like so:
1 32432.4323
2 23432.1143
.
.
.
999 1111.23432
I also have a function f(x), 2*x^2+1
I'd like to plot the difference curve between the function and the y values. Something like this:
1 32432.4323 - f(1)
2 23432.1143 - f(2)
.
.
.
999 1111.23432 - f(999)
I can do it by calculating the difference and placing into a separate file values_diff.txt and loading that into matplotlib, but I was wondering if there was a more idiomatic way of doing this in matplotlib that doesn't require the explicit use of a second file,