I am attempting to create a color heatmap using ListSurfacePlot3D with a dataset in the format {X, Y, Z, v}, where 'v' represents the color scale.
The dataset is stored in a CSV file with four columns: 'X', 'Y', 'Z', and 'v'. Each row corresponds to a point in 3D space, identified by the positional information. My goal is to generate a surface heatmap using ListSurfacePlot3D, with colors determined by the values in the 'v' column and following the "BlueGreenYellow" color palette.
I have successfully generated the surface using the "X," "Y," and "Z" values.
filePath = "df_VHH_12nm_final.csv";
data = Import[filePath];
coordinates= data[[All, {1, 2, 3}]];
ListSurfacePlot3D[coordinates, Mesh -> None,
MaxPlotPoints -> 50]
However, I am unable to associate the colors to the surface using a color palette and the row-specific 'v' values. Any ideas?
Thank you so much for your help!
EDIT/Solved: I was able to follow the info found on this post.
filePath = "df_VHH_12nm_final.csv";
data = Import[filePath];
nf = Nearest[data[[All, {1, 2, 3}]] -> Rescale[data[[All, 4]]]]
colfun = ColorData["AvocadoColors"]@First@nf[{#1, #2, #3}] &
ListSurfacePlot3D[data[[All, {1, 2, 3}]],
MaxPlotPoints -> 50,
BoxRatios -> Automatic,
ColorFunction -> colfun,
ColorFunctionScaling -> False,
Axes -> False,
Boxed -> False]
data[[All, {1, 2, 3}]]extracts the coordinates, not the colors. The colors would bedata[[All, 4]]. And you don't show how you attempted to use the colors. – Bob Hanlon Jan 24 '24 at 18:03I have tried to do stuff like this:
– Mario Gutierrez Diaz Jan 24 '24 at 22:19