I have a pandas data frame that looks like:
X,Y,VAL
3,1,1221.231
3,3,121.2
3,4,4354.2
3,...,...
3,1200,12.1
...
5,1,756.3
5,2,12.01
5,...,...
...,...,...
123,110,23.1
123,1119,65.9
Note that x,y values are in the first and second column, different from what pyplot imshow expects (a multi dimensional array).
We have in the first n lines all Y values to the first X coordinate an the after that cames the second X value and all Y values related to that line, the thing goes on until it encounters the latest line. The dots here represents that data continues in more rows.
The values on third column it goes the measured quantity over the map.
I have tried to iterate over or build a mesh using the method "unique" from pandas library to built the coordinates, but the non regularity of source turned thing complicated
IS there any functions able to process this in something "graphable" in imshow or convert it to another kind of table/matrix?
Using one of the proposed solutions isn't viable because the coloring can't be interpolated. My source mesh isn't so sparse, but unfortunately I can't garantee that is regular. (but it can be in some cases).
But let's suppose that I have some data like
x y value
64 4 2743
64 8 3531
64 16 4543
64 32 5222
64 64 5730
128 4 2778
128 8 3500
128 16 4657
Is there any function able to convert this table to imshow compatible? (line/column based on x/y values) or I need to iterate over it ?
After try the proposed solution, I came to a optimization issue, also Iwas not able to create the v_mesh on attempt to use pcolormesh. It can be seen here Optimizing non regularized data reading to image as another question.