How to Plot Sin(X) + Sin(Y) = 1 in Gnuplot?

How to Plot Sin(X) + Sin(Y) = 1 in Gnuplot?

I am trying to plot the parametric function sin(x) + sin(y) = 1, but I'm not quite there yet. Here's my script:

set parametric

set urange [-10:10]
set vrange [-10:10]
set sample 2000
set size ratio -1
set grid front
unset border

splot sin(u) + sin(v) = 1

But I get the error: line 10: parametric function not fully specified. What should I do? I want my function plotted as Desmos does it, in the Cartesian coordinate system:

Thank you for your suggestions in advance.

2

1 Answer

sin(x) + sin(y) = 1 is not a parametric equation but an implicit equation. Either you need to do some maths and find a corresponding parametric equation, or you need to resort to a 'trick' which is the one you've probably used in Desmos: gnuplot can plot isolines of functions, so you can plot the isoline 1 of f(x,y)=sin(x) + sin(y).

set cntrparam levels discrete 1
set contour
set view map
unset surface
set isosample 100
splot sin(x)+sin(y)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Robert Thorne
Author

Robert Thorne

Robert Thorne covers electric vehicle innovations, autonomous driving systems, global mobility trends, and automotive engineering developments.