Using a programming language with gnuplot might give better control over plots.
Here is an example using c and a script.
plot.c
#include <stdio.h>
#include <math.h>
int main()
{
int x, y;
double z;
for (y=-10; y <= 10; y++)
{
for (x=-10; x <= 10; x++)
{
z = x * 0.025;
printf("%f %f %f\n", (double)x, (double)y, 100 - cos(z * M_PI*2) * 100);
}
printf("\n");
}
fflush(stdout);
return 0;
}
plot.bat
gcc plot.c -o prog.exe -lm
prog > data.txt
echo splot "data.txt" using 1:2:3 with lines | gnuplot -p
plot.sh
gcc plot.c -o prog -lm
./prog > data.txt
echo 'splot "data.txt" using 1:2:3 with lines' | gnuplot -p
Here is an example using python and a script.
It will output:

plot.py
import math
print("\"Surface One\"")
for y in range(-10, 10+1):
for x in range(-10, 10+1):
z = x * 0.025
print("%f %f %f 1" % (float(x), float(y), 100 - math.cos(z * math.pi*2) * 100))
print("")
print("")
print("\"Surface Two\"")
for y in range(-10, -8+1):
for x in range(-10, 10+1):
z = x * 0.025
print("%f %f %f 2" % (float(x), float(y), 100 - math.cos(z * math.pi*2) * 100))
print("")
print("")
print("\"Surface Three\"")
for y in range(-10, 10+1):
for x in range(-10, 10+1):
z = x * 0.1
print("%f %f %f 7" % (float(x)/2, float(y)/2, math.sin(z * math.pi*2) * 10))
print("")
print("")
plot.bat
cd %~dp0
python plot.py > data.txt
echo ^
set terminal wxt size 570,420; ^
stats "data.txt" u 1:2 nooutput; ^
set border 0x7F linecolor rgb "#555555"; ^
set grid xtics linecolor rgb "#888888" linewidth 0.2 linetype 9; ^
set grid ytics linecolor rgb "#888888" linewidth 0.2 linetype 9; ^
set grid ztics linecolor rgb "#888888" linewidth 0.2 linetype 9; ^
set xrange [-10.0:10.0]; ^
set yrange [-10.0:10.0]; ^
set zrange [-10.0:100.0]; ^
splot for [IDX=0:STATS_blocks-1] "data.txt" i IDX using 1:2:3:4 with lines ^
lc variable title columnheader(1) | gnuplot -p
plot.sh
#!/bin/bash
python plot.py > data.txt
echo \
'set terminal wxt size 570,420; \
stats "data.txt" u 1:2 nooutput; \
set border 0x7F linecolor rgb "#555555"; \
set grid xtics linecolor rgb "#888888" linewidth 0.2 linetype 9; \
set grid ytics linecolor rgb "#888888" linewidth 0.2 linetype 9; \
set grid ztics linecolor rgb "#888888" linewidth 0.2 linetype 9; \
set xrange [-10.0:10.0]; \
set yrange [-10.0:10.0]; \
set zrange [-10.0:100.0]; \
splot for [IDX=0:STATS_blocks-1] "data.txt" i IDX using 1:2:3:4 with lines \
lc variable title columnheader(1)' | gnuplot -p