CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   How to get contour or surface plot form datafile (with gnuplot)? (https://www.cfd-online.com/Forums/main/175605-how-get-contour-surface-plot-form-datafile-gnuplot.html)

FrancescoLRomeo August 2, 2016 06:43

How to get contour or surface plot form datafile (with gnuplot)?
 
Hello,
I would like to use gnuplot to plot my 2d function ch(x,y) [generated by FreeFem++]. My datafile is structured in this way:

x1 y1 ch(x1,y1)
x2 x2 ch(x2,y2)
x3 y3 ch(x3,y3)
x1 y1 ch(x1,y1)

x4 y4 ch(x4,y4)
...
...
...

...

where I have the value of my function at the 3 vertices of every triangle which constitutes my (triangular, not structured) mesh (see figure here http://i65.tinypic.com/2mydkq9.jpg).
What I would like to get is two separate figures:
1. something like this for the surface, with a colorbar as a legend:
http://i68.tinypic.com/egvkzr.jpg
and
2. something like this for contour lines, with a colorbar as a legend:
http://i67.tinypic.com/msgepg.jpg

How can I get these two figures with gnuplot?
I've tried for example doing the first one :

set palette rgbformulae 33,13,10
set xrange [0: 0.25]
set yrange [0: 0.20]
set view map
splot "mydatafile.txt" w l pal

but the triangles inside are white (not filled with colors) and only the edges of the triangles are coloured.
How about the contour lines?

Thank you in advance,

Keccogrin


All times are GMT -4. The time now is 18:46.