Mak
Mak

Reputation: 11

3d visualization of vector data in mathematica

I am trying to visualize my data in 3D and different magnitude of vector with different color.

So far I have imported the data using, 'data = Import["File"]' and used, 'vecdata = Partition[#, 3] & /@ DeleteDuplicates[data]'

The image should look close to this Vector map

https://docs.google.com/spreadsheets/d/1PUWVkJ4t3vC1KK8n4NWIjxIbQhl6JWRbeewPMjw9OFg/edit?usp=sharing

Upvotes: 1

Views: 961

Answers (1)

Jason B.
Jason B.

Reputation: 161

So ListVectorPlot3D wants an array of vectors. What you have is a list of ${x_i, y_i, z_i, Vx_i, Vy_i, Vz_i}$ elements. If you had your x, y, and z points all laid out on a regular grid, then you could rearrange the elements to be in the correct format, but your data is not on a regular grid. To get around this, I will create a linear interpolation function and use VectorPlot3D. Also, your data has some duplicate points so I had to remove them.

I downloaded your data as a CSV file,

data = DeleteDuplicates@
   Import["~/Downloads/Cell Well data - Sheet1.csv"][[2 ;;]];

xfunc = Interpolation[(data[[All, ;; 4]]), InterpolationOrder -> 1];
yfunc = Interpolation[(data[[All, {1, 2, 3, 5}]]), 
   InterpolationOrder -> 1];
zfunc = Interpolation[(data[[All, {1, 2, 3, 6}]]), 
   InterpolationOrder -> 1];
{{xmin, xmax}, {ymin, ymax}, {zmin, zmax}} = 
  MinMax /@ Transpose[data][[;; 3]];

VectorPlot3D[{xfunc[x, y, z], yfunc[x, y, z], zfunc[x, y, z]}, {x, 
   xmin, xmax}, {y, ymin, ymax}, {z, zmin, zmax}] // Quiet

enter image description here

Upvotes: 2

Related Questions