1
votes

I would like to display the image of two real valued analytic functions f,g (of two real variables x,y each) in a two dimensional plot. I.e. I want to sample (x,y) and make gnuplot display a dot (f(x,y),g(x,y)) in the two dimensional f,g plane for each sampling point. Of course I can sample (x,y) in an external program and output a 2 column data file to produce this plot. It does not even take much more effort to do it. I am asking mainly because gnuplot might have builtin routines to do the sampling of (x,y) in a more clever way than a two-dimansional grid with equal spacings.

1

1 Answers

0
votes

This depends on how you want to have x and y varied. I suppose, if you're doing a scatter plot, it probably doesn't matter much. If I understand your question properly, you can do that relatively easily.

set parametric

#view from inifity on the z-axis
set view map

#example functions
f(x,y)=sin(x)*cos(y)
g(x,y)=cos(x)*sin(y)

splot f(u,v),g(u,v),0 w points

This will only sample at evenly spaced x and y however. If you want something a little more clever/complicated, you can write another function to transform x into any other function of x that you want -- e.g.:

X(x)=x**2
f(x,y)=sin(X(x))*cos(y)
...