I have a function that takes one 2D vector and returns pdf (a scalar) of that point.
As an illustration, myPDF( np.array[4,4] ) returns a single pdf value at <4,4>. This function cannot take a list of vectors, and it only accepts one 2D vector as an argument.
Now I want to plot this pdf using plot_surface like below:
This is what I've tried
x = np.arange(-10,10)
y = np.arange(-10,10)
z = [ myPDF( np.array([xx,yy])) for xx in x for yy in y]
xy = [ [xx, yy] for xx in x for yy in y]
And here I am stuck. I have to somehow reshape z and xy in some proper forms to use them with plot_surface, but I do not now how to do so. I also tried meshgrid, but did not know how to convert different shapes of data into legitimate forms for plot_surface.
x, y = np.mgrid[-5:5,-5:5]
If I use mgrid as above, it gives me 10x10 matrix. Then, I have to generate corresponding z values in 10x10 matrix using my function, but could not find a way to decompose x and y, generate z values and reformat z values in a proper form.
The major problem here is that I have little knowledge in manipulating data, so could not find a good way of doing this task. Thus, I'd like to learn a proper way of generating a dataset for plot_surface using my pdf function.
What's a good way to generate data points to plot like this using my pdf function? Thanks for helping this newB!