## Saturday, September 24, 2011

### Implicit function plotting using gnuplot

Assume three is an equation f(x,y)=g(x,y), and we want to plot the roots which obey this equation. This is a typical implicit function plotting problem. How do we handle this problem using gnuplot?

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)
```
Picture implicit.png is as follows.

 Implicit Plot Using Gnuplot

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

2. Muchísimas gracias! Martín

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

:D

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

5. IOT Training in Bangalore - Live Online & Classroom
Iot Training course observes iot as the platform for networking of different devices on the internet and their inter related communication. Iot Training in Bangalore

python certification