Would RectBivariateSpline work for me? Other ideas?

Happy holidays everyone,

I’m still working on getting these pcolormesh plots that I’m interested in. Basically I have a grid of data that is irregular but not random. My xgrid values are something similar to [0, 1, 2, 3, 4, 4.5, 5, 5.5, 6, 7, 8 ,9 , 10] to give you a sense. My ygrid values are also ordered smallest to lowest, although the spacing as y is increased is much less uniform. Perhaps importantly, the y values available for one x value are not the same available for the neighboring x value. For every (x,y) point I have I have a corresponding value for z. Qualitatively, you can imagine my dataset as being a set of data on a line sqrt(1-x). For each x,y point on the line sqrt(1-x) I have a z value. If this z value were something like z=f(x,y)=1-x, then my output plot should look like the line sqrt(1-x), but with greater intensity at x=0 and lesser as it moves towards x=1.

Of course, I’m trying to do a pcolormesh plot, and so I figured I needed to pad "0"s into my data to make the other parts of the plot black (in the ‘hot’ color scheme). So for each x value, I added some extra 0’s at the y points which are around my sqrt(1-x) data, so that all of this area would interpolate to 0.

I’ve tried using griddata to interpolate onto a regular grid. Sometimes my input works correctly and I get a plot that is what I would expect it to be. However, other times (with slightly different data sets or a different grid that I’m interpolating to) I get bad interpolation apparently around the edges of the plot and get large values there (whereas most of it should just be 0). Also, it appears that griddata will run very, very slowly on the size of data that I need to interpolate to (extrapolations based on small tests would suggest days possibly with no guarantee that the results would not be in error).

Can anyone think of why what I’m doing might not be working correctly with griddata? What situations cause griddata to fail? Maybe if I knew them I could make sure they don’t happen. Or perhaps there is another alternative I could try? I suppose I couldn’t use RectBivariateSpline unless my input grid was fully rectangular (which my current distribution of y values prevents)? Or is this incorrect?

Or, can anyone think of another way I can show the data I’m trying to show? I might be able to figure out how to draw the line (for example) sqrt(1-x) with a linesize which is proportional to the z=f(x,y) value, but that sort of distorts the line sqrt(1-x) which I’m trying to preserve the shape of.

Thanks for any help you can give. I really appreciate it! Please let me know if I can provide more information that would help.



. My ygrid values are also ordered smallest to lowest, although the spacing as y is increased is much less uniform.

Sorry, of course I meant ygrid values are ordered smallest to highest…