Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I have a list of trajectories from a bunch of photons that travel inside a scattering medium. Each trajectory is a list of $(x,y,z)$ pairs. I'd like to visualise them in 3D space. I came up with the simplest (and ugliest) way:

data = Import["http://dl.dropboxusercontent.com/u/25202446/dat.3d", "List"];
data = ToExpression /@ data;
Graphics3D[Line /@ data, Axes -> True, AxesLabel -> {"x", "y", "z"}]

enter image description here

I also tried with Points instead of connected lines but of course the result is also very "primitive".

Another idea was to use the SmoothDensityHistogram[] and SmoothHistogram3D[] like this (I did some modifications in the code so that it works outside the context of my notebook. I hope that it does indeed):

plot1 = SmoothDensityHistogram[
   Take[#, 2] & /@ Flatten[data, 1],
       ColorFunction -> "Rainbow", Ticks -> None, Frame -> False];

plot2 = SmoothHistogram3D[
    Take[#, 2] & /@ Flatten[data, 1],   
        ColorFunction -> "Rainbow", ViewPoint -> {1, 1, 1}, Ticks -> None, 
        Boxed -> False, Axes -> False];

comb = Style[Grid[{{plot1, plot2}}], ImageSizeMultipliers -> 1]

NOTE: The graphs that are generated may not look like entirely identical to the ones that I embedded, because the sample size is different.

enter image description here

share|improve this question
    
It would be very helpful if you were to give us some idea of what you would consider as a satisfactory result. Without such guidance, I think your question is too vague. –  m_goldberg Jun 21 at 13:50
    
Why do I only get that? –  Öskå Jun 21 at 13:51
    
@Zet Ok you must have updated it, now it looks like c**p :) –  Öskå Jun 21 at 13:57
    
@m_goldberg In all honesty, I don't really know. Something more colourful, smooth, that would give the hint where most photons travel. But I'm open to any idea, I wouldn't want to restrict people's imagination. –  Zet Jun 21 at 13:59
    
Do you specifically care about the trajectories or just the positions? –  Rahul Jun 21 at 19:34

2 Answers 2

You could create your own 3D density plot. Here's a simple example:

raw = Import["http://dl.dropboxusercontent.com/u/25202446/dat.3d", "List"];
data = ToExpression@raw;

rescaled = data /. Dispatch@With[{d = Flatten@data}, MapThread[Rule, {d, Rescale@d}]];
rounded = (unit = 100)*Round[rescaled, 1/(10 unit)] /. n_?NumericQ :> IntegerPart[n + 1];
tally = Tally@Flatten[rounded, 1];
tally[[All, 2]] = Rescale@tally[[All, 2]];
Graphics3D@{Raster3D[SparseArray[Rule @@@ tally], 
  ColorFunction -> {"HighRange", Min@tally[[All, 2]]/2}]}

enter image description here

share|improve this answer
    
That's not bad, not bad at all. Hm. –  Zet Jun 21 at 19:04
ListPointPlot3D[data, Filling -> Bottom, ImageSize -> 600, 
 ColorFunction -> "RedGreenSplit"]

enter image description here

data = Flatten[ToExpression /@ 
    Import["http://dl.dropboxusercontent.com/u/25202446/dat.3d", "List"], 1];

Histogram[Transpose@data, ImageSize -> 600, ChartLegends -> {"X", "Y", "Z"}]

enter image description here

ListPointPlot3D[data, ImageSize -> 600, 
 ColorFunction -> "TemperatureMap", ViewPoint -> Right, 
 Background -> Black, BaseStyle -> White, 
 AxesLabel -> {"X", "Y", "Z"}]

enter image description here

share|improve this answer
    
Is that a subtle cheer for italy? –  Yves Klett Jun 21 at 16:19
1  
@Yves - por Mexico, naturalmente :) –  eldo Jun 21 at 16:32
    
Thanks @eldo for taking the time to write up an answer! The "problem" with the last one is that it colors based on the value of the coordinates, not based on the density of the points (I think). –  Zet Jun 21 at 19:08
    
@zet - that's true. My personal difficulty with your nice question is the following: You speak of a "bunch of photons". Where is the "bunch" in your data? I assumed that all points are different photons with their xyz-coordinates measured at one point of time with a "photon clock". If so, you cannot connect them with lines because they are different entities. If I am wrong (let's assume there are 100 time-trajectories of 1000 photones), you would need a 4D-screen after having overcome the "Uncertainty principle". –  eldo Jun 21 at 21:32

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.