Reputation: 2365
I am trying to make a 3D, surfaced graph using gnuplot (in C++). This is code I currently have.
//gp << "set dgrid3d\n";
//gp << "set samples 10,10\n";
//gp << "set isosamples 10,10\n";
//gp << "set contour\n";
//gp << "set hidden3d\n";
//gp << "set surface\n";
//gp << "set pm3d\n";
gp << "splot 't.dat' u 1:4:5 w linespoints pointtype 7 pointsize 1.5, \
't.dat' u 2:4:5 w linespoints pointtype 9 pointsize 1.5, \
't.dat' u 3:4:5 w linespoints pointtype 4 pointsize 1.5\n";
As you can see I have tried a number of commands (currently commented) to achieve the goal. I cannot seem to find a suitable combination of commands or a single command which gives me a 3D graph with a surface like which I seek.
This is 't.dat' - the data that I am attempting to plot:
#timeTaken1 timeTaken2 timeTaken3 D E
1.2342423 1.33 2.442 1 0
1.234234 1.55 2.236 1 20
2.56465 1.56 3.39 1 40
2.464 1.234 3.224 1 60
2.2747 1.768 3.552 1 80
2.34774 1.876 3.574 1 100
3.34747 2.94 4.795 2 0
3.34747 2.66 5.776 2 20
3.3747 3.234 5.666 2 40
3.787 3.66 6.503 2 60
3.456 3.88 6.37 2 80
4.345 3.345 5.853 2 100
Does someone know what needs to be done to make this work? Is there something wrong with the structure of the data? Is there some command I haven't seen?
Upvotes: 0
Views: 816
Reputation: 2344
With splot
you can only plot your data points (and connect them) as you can in 2D. To draw a surface, you have to find out an f(x,y)
function and also splot
it. Or you can manually interpolate a hundred or thousand of the surface coordinates into 't2.dat' and splot 't2.dat' w l
.
Upvotes: 1