Python newbie here.. I've been at this for weeks and haven't had much luck.
I'm trying to plot 3d grid maps in python. I have a .csv file that has the format:
X Y Z diff
1 1 1 14
-1 1 2 10
1 -1 -1 -5
etc
#162 columns of xyz data with intensities
My goal is to generate a grid map of these coordinate points and color them based on the intensity. I've been able to get some plots, but they all look like garbage, and I can't get the coloring right, but that's a different question.
The paper that I'm going off of said they used Delaunay triangulation and the Mayavi python package to obtain their figures, so that's what I'm trying to figure out.
I'm able to obtain the triangles, using:
tri = Delaunay(array)
#this triangulates the coordinate data from the csv, labeled array
triangles = array[tri.simplices]
#this turns it into an array that I can use
and I wind up with an array with the shape:
array([[[-5.032, -0.625, 1.102],
[-5.237, -0.074, 0.427],
[-4.976, -1.697, -0.624],
[-5.676, -1.089, 0.111]],
[[ 3.564, 3.992, -0.129],
[ 5.074, 1.595, 0.326],
[ 8.42 , -2.487, 0.169],
[ 5.738, 0.636, -0.03 ]],
[[-3.183, 1.035, 1.651],
[-2.892, 1.923, 1.427],
[-3.699, 2.155, 0.96 ],
[-4.301, 0.523, 1.506]],
...,
Using Mayavi's triangular mesh function,
triangular_mesh(x, y, z, triangles, scalars=diff)
#where x, y and z are arrays of each individual coordinate
I wind up with the error:
ValueError: The triangles array has negative values
I have a general idea on why it's not working, that triangles should be positive, but I'm not sure why mine are negative..
Where should I be looking? I'm kinda lost and overwhelemed, there's just so much information that I don't know what to do with. I don't want full solutions, but just some guidance on good sources