1

I am trying to make a 3D color plot with pm3d in Gnuplot. It is heatmap for a heat transfer problem in a cube. So, I have 4 columns in my data file: x, z, t and T which are respectively the horizontal coordinate, the vertical coordinate,the current time in the simulation (always t = 0 s, here) and the temperature. I want to plot the variation of temperature with x and z in 3D.

When I do it with Gnuplot,

set size square
set xlabel("x")
set ylabel("z")
set zlabel("T")
set xrange [-0.01:1.01]
set yrange [-0.01:1.01]
set hidden3d
set palette rgb 33,13,10 
set pm3d implicit at s 
  

splot "para_heat_3D_inta.dat" using 1:2:4 with pm3d notitle
pause mouse keypress" | gnuplot -persist 

I see that the highest temperature (373 °K) is not correctly represented according to the colorbar. Indeed, at every z = 0 or z = 1, it must be T = 373 °K as it is in my data file.

My data file looks like:

  x      z      t       T
0.000  0.000  0.000  373.000
0.000  0.005  0.000  298.000
.....
0.000  0.985  0.000  298.000
0.000  0.995  0.000  298.000
0.000  1.000  0.000  373.000
 
0.005  0.000  0.000  373.000
0.005  0.005  0.000  283.000
....
0.005  0.995  0.000  283.000
0.005  1.000  0.000  373.000
 
0.015  0.000  0.000  373.000
0.015  0.005  0.000  283.000
....
0.015  0.995  0.000  283.000
0.015  1.000  0.000  373.000
 

The colorbar shows a red color for this temperature level, however, my plot displays it in light green although the surface reaches the correct hight... Here is my Graphic:

enter image description here

I have made several pieces of research on the net, but not find anything. Maybe someone could help me with this?

Thanks in advance.

theozh
  • 22,244
  • 5
  • 28
  • 72
Jejouze
  • 23
  • 6
  • If you have N x N datapoints you will have (N-1)x(N-1) surfaces. I guess the question is which color do you want to assign to them? Check this: http://gnuplot.sourceforge.net/demo/pm3d.html (the very last graph). Right now, I don't have a good suggestion how to solve this. Probably you need a finer mesh. – theozh Aug 27 '21 at 13:11
  • By mesh, do you mean the mesh of the heat transfer simulation? If it's that, I did the same code with the same mesh in python (with matplotlib) and it works. But for some reason, I have to do it in C++ with Gnuplot. – Jejouze Aug 27 '21 at 14:19
  • Apparently, matplotlib has a different coloring scheme. Could you maybe edit your question and add the matplotlib image to your question for comparison? – theozh Aug 27 '21 at 14:29

1 Answers1

1

I guess the short answer (without illustrative example) is:

set pm3d corners2color max

Check help pm3d.

theozh
  • 22,244
  • 5
  • 28
  • 72