July 29th, 2011 | 4 Comments
In one post we have used the parametric plot option to plot the world. Here we want to add some temperature data as a heat map to the world plots. The data show the temperature anomalies of the year 2005 in comparison to the baseline 1951-1980 and is part of the GISTEMP data set.
The first problem you face, if you want to create a heat map, is that the data has to be in a specific format shown in the Gnuplot example page for heat maps. Therefore we first arrange the data and end up with this temperature anomalies file. Unknown data points are given by 9999.0.
In order to plot this data to the 2D world map we have to add a reasonable
cbrange and a color
palette and the plot command for the map:
set cbrange [-5:10] set palette defined (0 "blue",17 "#00ffff",33 "white",50 "yellow",\ 66 "red",100 "#990000",101 "grey") plot 'temperature.dat' u 2:1:3 w image, \ 'world.dat' with lines linestyle 1
The trick with the wide range from 0 to 101 for the color bar is chosen in order to use
grey for the undefined values (9999.0) without seeing the grey color in the color bar. The result is shown in Fig. 1.
The same data can easily be applied to the 3D plot of the world. We have to add
front to the
hidden3d command in order to make the black world lines visible. In addition the radius must be given explicitly as third column to the plot command for the temperature data.
set hidden3d front splot 'temperature.dat' u 2:1:(1):3 w pm3d, \ r*cos(v)*cos(u),r*cos(v)*sin(u),r*sin(v) w l ls 2, \ 'world.dat' u 1:2:(1) w l ls 1
The result is shown in Fig. 2.