I have the next code in python to generate a 3D figure with MatPlotLib, but i need your help to change my code in order to be able to create a Heat Map instead the 3D figure.
My actual code:
Data Source--> data.dat contains:
(1st column is 'x', 2nd column is 'y' and third column is 'z')
0.00 0.00 0.38
1.11 0.00 0.38
.
.
.
95.00 1.80 0.38
.
.
.
This file have 3231 similar rows... Code:
**f_name='/home/data.dat'
data=np.loadtxt(f_name, delimiter='\t', unpack=True)
datos=np.array(data.tolist())
x = datos[0,:]
y = datos[1,:]
z = datos[2,:]
xi = np.linspace(min(x), max(x))
yi = np.linspace(min(y), max(y))
X, Y = np.meshgrid(xi, yi)
Z = griddata(x, y, z, xi, yi)
Z[np.isnan(Z)] = 0
fig = plt.figure()
ax = Axes3D(fig)
surf= ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.jet_r , linewidth=1, antialiased=True)
ax.set_zlim(-25, 25)
ax.set_xlim(0, 100)
ax.set_ylim(0, 102)
#more resolution:
start_x, end_x = ax.get_xlim()
ax.xaxis.set_ticks(np.arange(start_x, end_x, 0.25))
ax.xaxis.set_major_formatter(FormatStrFormatter('%0.1f'))
start_y, end_y = ax.get_ylim()
ax.yaxis.set_ticks(np.arange(start_y, end_y, 0.25))
ax.yaxis.set_major_formatter(FormatStrFormatter('%0.1f'))
#ColorBar:
fig.colorbar(surf, shrink=0.5, aspect=5)
ax.set_xlabel('X')
ax.set_ylabel('Y')
ax.set_zlabel('Z')
ax.set_title('3D Figure')
fig.savefig(pathfilename, dpi=300)**
so... i would like to generate a Heat Map using the same data source, when the 'z' column is the color depth, and also increase the X, Y resolution like in this 3D figure.
Can you help me? Others Heat Map examples in this site are good reference but i do not understand exactly what changes i need to do in my actual code using my data source (data.dat).
Most of time, this code will execute offline.
I prefer a free library like MatPlotLib or another free solution that you know.
Thanks a lot!!!