The most simple idea is solving the equation analytically (or numerically), and get the the root y=h(x) (or a data file containing the roots). Then plot h(x) (or the data file) with gnuplot. Of course, it is OK. But here we provide a more simpler method.

Note that the contour line at level 0 for function z=f(x,y)-g(x,y) is just the lines made up by the points which obey equation f(x,y)=g(x,y). So we can convert implicit function plotting problem to a contour plotting problem. Now come to a example.

reset set term png enhanced lw 2 font "Times,18" set output "implicit.png" set contour set cntrparam levels discrete 0 set view map unset surface set nokey set isosamples 1000,1000 set xrange [-2:2] set yrange [-2:2] set xlabel "x" set ylabel "y" set title "Implicit plot of sin(x^2+y^2)=exp(-xy)" splot sin(x**2+y**2)-exp(-x*y)

Implicit Plot Using Gnuplot |

There is always a clever way to make anything in gnuplot, the important thing is to find it. Thanks a lot!!!!

ReplyDeletezub7

Muchísimas gracias! Martín

ReplyDeleteyumm yumm .. aahhh .. thank you .. my gnuplot snack of the day

ReplyDelete:D

Is this also possible with 3 variables x,y, and z?

ReplyDelete