I start with two linspaces and I have them meshgrid. Then I calculate the function values ββon the grid. My function is called cpt_hcpv() . Then I would like to combine my data with each grid point with the corresponding function value.
The code looks like
poro = np.linspace(min(poro), max(poro)) sw = np.linspace(min(sw), max(sw)) g = np.meshgrid(poro, sw) points = zip(*(x.flat for x in g)) hcpv = [] for p in points: hcpv = hcpv + [cpt_hcpv(p[0], p[1], poro, sw)]
from
def cpt_hcpv(pCut, sCut, poro, sw): #find points belonging to calculation truncated = [(p, s) for p, s in zip(poro, sw) if p > pCut and s < sCut ] hcv = 0 for k in truncated: hcv += p*(1-s)*0.5 return hcv
Why I donβt calculate cpt_hcpv() directly on the grid: because I have to deal with the condition in understanding truncated = [(p, s) for p, s in zip(poro, sw) if p > pCut and s < sCut ] , so that I have to iterate over a point in the grid. I don't know how to iterate on a meshgrid.
So, I would like to warm up from 3d coordinates : in points I have x and y for points and in hcpv I have z parameters for each point, in the same order.
From the examples I found, there are pylab and matplotlib solutions for constructing a heat dissipation diagram from the values ββof meshgrid + calculated on the grid, using a method that takes meshgrid as an argument.
Is there a way to build a heat map from 3d coordinates?