Desired Image
[
My CSV data consists of X axis value, Y axis value and Hardness value and I wanted to plot smooth heat map rather than in boxes like.
import cv2 from skimage.io import imread, imshow from skimage.transform import resize import numpy as np import matplotlib.pyplot as plt import matplotlib.image as mpimg import glob import os from tqdm import tqdm import pandas as pd import seaborn as sns from sklearn.neighbors import KernelDensity from mpl_toolkits.mplot3d import Axes3D from matplotlib import style from astropy.convolution import convolve, Gaussian2DKernel from scipy.ndimage.filters import gaussian_filter
path = r"C:\Users\patels\Desktop\Ti/"
ids = os.listdir(path)
#print(ids)
for n, id_ in tqdm(enumerate(ids), total=len(ids)):
data = pd.read_excel(path+id_)
print(path+id_)
df1 = data[['HV 0.2', 'X pos. [mm]', 'Y pos. [mm]']]
heatmap1_data = pd.pivot_table(df1, values='HV 0.2', index=['Y pos. [mm]'], columns='X pos. [mm]')
plt.figure() #this creates a new figure on which your plot will appear
heatmap1 = sns.heatmap(heatmap1_data, cmap="viridis", vmin=300, vmax=400)
plt.title(ids[n]+'Ti Hardness Map')