I want to create layered contour plots using (x,y,z) coordinates and a fourth dimension, represented by color and intensity. Each layer-related data is in the CSV file (data) with lat, lon, levels, and dust_mixing_ratio columns. How to create and superimpose all the heatmaps of each level along the Z-axis? Or is there any other way to plot my data in 4D like the sample image? So far I have tried to plot using the following code as mentioned in Plot 4D data as layered heatmaps in Python but I am unable to understand how to proceed further?
def grids_maker(filepath):
# Get the data
df = pd.read_csv("D:\DATA\2015\MIXING_RATIOe.csv", sep=' ')
# Make things more legible
xy = df[['lat', 'lon']]
x = xy.lat
y = xy.lon
z = df.levels
g = df.dust_mixing_ratio
reso_x = reso_y = 50
interp = 'cubic' # or 'nearest' or 'linear'
# Convert the 4d-space's dimensions into grids
grid_x, grid_y = np.mgrid[
x.min():x.max():1j*reso_x,
y.min():y.max():1j*reso_y
]
grid_z = si.griddata(
xy, z.values,
(grid_x, grid_y),
method=interp
)
grid_g = si.griddata(
xy, g.values,
(grid_x, grid_y),
method=interp
)
return {
'x' : grid_x,
'y' : grid_y,
'z' : grid_z,
'g' : grid_g,
}