Tuesday, July 19, 2011

Gnuplot example: plotting implicit curves (level curves)

In this example, we will plot the implicit curve (level curve, contour line) defined by
the equation fun(x,y) = 0.

fun(x,y) =


gnuplot script:

fun(x,y) = (x*x+y*y-3)*sqrt(x*x+y*y) + 0.75 \
+ sin(8*sqrt(x*x+y*y))*cos(6*atan(y/abs(x))) - 0.75*sin(5*atan(y/abs(x)))
set xrange [-2:2]
set yrange [-2:2]
set size ratio -1
set samples 512
set isosamples 512
set contour base
set cntrparam levels discrete 0
unset key
unset xtics
unset ytics
unset border
unset surface
set table 'curve.dat'
splot fun(x,y)
unset table
plot 'curve.dat' w l lw 1.5 lc rgb "red"


The result plot:



Related posts:

No comments:

Post a Comment