Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to use `dgrid3d` in `gnuplot` correctly?

Tags:

gnuplot

3d

I've got a data file which contains a bunch of x, y and z points. I'd like to use gnuplot to plot out these points with pm3dbut this requires me to turn on set dgrid 10,10,1 (the number should be different). THe problem is that my data gets warped (the points don't lay on the pm3dsurface when I plot them out together).

How should I use dgrid3d? The points are generated from a c++ program, so I can choose the x and y spacing myself.

My data looks like this:

# X    Y    Z
  1    2    3
  2    2    4
  ...

I'd like it to be a colored surface that runs through these points in 3D space. The x and y data is spaced evenly, while the z data is a function of x and y points.

like image 675
romeovs Avatar asked Apr 17 '11 18:04

romeovs


1 Answers

If you have your data available in a file Data.dat then give this a try:

set dgrid3d 10,10
set style data lines
set pm3d 
splot "Data.dat" pal
  • The dgrid3d tells gnuplot how many entries there are in the x- and y-direction (those are the two comma separated parameters)
  • The style data lines lets gnuplot plot the result with lines instead of points
  • The pm3d fills the surface with a color (if you leave this away you will just see the lines)
  • pal makes the lines appear in the color of the specified value

There are much more options you can set, but i find those the most relevant.

like image 180
Woltan Avatar answered Oct 30 '22 05:10

Woltan