1
votes

I'm trying to graph an approximate solution (finite element method) to the Navier-Stokes equation. I've got a file called plotNSu1 that looks like this:

6 1 4.21022e-34

5.95 1 8.15227e-34

5.9693 0.970854 0.055197

6 1 4.21022e-34


5.9693 0.970854 0.055197

6 0.95 0.0941333

6 1 4.21022e-34

5.9693 0.970854 0.055197


5.92625 0.951192 0.0915468

5.9693 0.970854 0.055197

5.95 1 8.15227e-34

5.92625 0.951192 0.0915468

...

(The entries are x y z, grouped so that there's a blank line between each set of 4 points).

I use the following command to plot:

splot "plotNSu1" with lines

Butt I would like to make it look nicer, easier to read. (There's a small dip at one spot that's difficult to see, but is an important part of the solution).

I've found lots of examples using pm3d interpolate, but none seem to work for me. I've tried set style pm3d, and other set style commands, I've tried set pm3d map interpolate 10,10, and splot "plotNSu1" with pm3d, as well as so many other similar things stolen from the examples I've found that I can't keep track. Most of the time I just get an empty window with the color key and no plot, and often it sends me an empty 2d window.

I would like to have the color change with the contour of the plot, to make the little dip easier to see. Does anyone know how to do this? Here's one of the websites I've been trying to use, to see what I'm aiming for: http://gnuplot.sourceforge.net/demo/pm3d.html

I tried to post the image, but as I do not have enough reputation, I can't. But it's difficult to see what's going on because the graph is just all red.

1
For pm3d your data must be gridded, which at least your example snippet doesn't show. Also you must know, that in any case pm3d does some interpolation: the color of each quadrangle depends on the values of one or more of the corners, see set pm3d corners2color.Christoph
My data is from a triangulation of a rectangle with a drop-off, I have function values at the vertices of each triangle (and technically at the barycenters as well, but I'm not worried about plotting that), so no, I guess it's not gridded. Thank you! Do you happen to know of another way to get a similar effect with ungridded data?JKH
Searching specifically for triangle data, I found this question: stackoverflow.com/questions/17154364/… which seems to mean my triangular mesh could work as a grid? I'm going to try to use this. Thanks again!JKH

1 Answers

1
votes

I found a way to make this work, more or less, thanks to @Christoph's help and this other question suggested by stackoverflow: gnuplot pm3d plot triangle data

With my data in the file described above, in gnuplot I type:

set dgrid3d

set pm3d corners2color c2

splot "plotNSu1" using 1:2:3 with pm3d

The result isn't perfect, it looks a little choppy, but it basically does what I wanted, I can see the "dip" in my graph much better now.