Data Science Asked by deeep on April 5, 2021
The result of my computational simulation is a (time-dependent) system of large number (~100k) of moving points in a confined space. Each point has its own Cartesian coordinates as well as a weight (w) in the form of $(x_i,y_i,z_i;w_i)$.
I’m looking for a software/app/package to create a snapshot of the 3D spatial density map of these points. (something like this).
Like you see in this figure, the points are not going to be displayed individually, but only a transparent cloud will be drawn whose local intensity is proportional with the local number of points.
The final goal is to create a movie of the changing 3D spatial density with time.
So far, I have tried R, Matlab, Origin, and ImageJ. But no success!
In Wolfram Language you may use ListDensityPlot3D
.
First we create some data to plot using a 3D density function at three time points (0, .5, and 1) using Table
.
p[t_, x_, y_, z_] := Cos[t z] + x y
densityClouds = Table[{x, y, z, p[t, x, y, z]},
{t, 0, 1, .5}, {x, -1, 1, .05}, {y, -1, 1, .05}, {z, π/2, 3 π/2, π/40}];
densityClouds
contains the 3 clouds but it is not the correct format for ListDensityPlot3D
.
Dimensions@densityClouds
{3, 41, 41, 41, 4}
We can Flatten
the two upper layers of each cloud (the x and y coordinates) to the third layer (the z coordinate) to get the correct format.
densityClouds = Flatten[#, 2] & /@ densityClouds;
Dimensions@densityClouds
{3, 68921, 4}
That we have data we can just plot the one of the clouds. The Last
cloud is t = 1
.
ListDensityPlot3D[Last@densityClouds,
PlotLegends -> Automatic,
AxesLabel -> {"x", "y", "z"}]
You may find other list 3D plots in the Data Visualization guide useful (like ListContourPlot3D
) and their 3D equivalents in the Function Visualization guide (like DensityPlot3D
).
Hope this helps.
Answered by Edmund on April 5, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP