0
$\begingroup$

I have code to plot some "2 dimensional" points in 3D space, and connect a line between them (because ListLinePlot3D takes way to long/hangs), which works fine:

Style[Show[
ListPointPlot3D[xyz, PlotRange -> {{420, 460}, {-1, 1}, {0, 10}}], Graphics3D[Line[xyz]]], 
Antialiasing -> False]

Graph

However, each time, when I change Line to Tube Mathematica crashes. WHY?

Here is the error message:

https://www.dropbox.com/s/vltp91syb8adcw2/Error.txt?dl=0

$\endgroup$
  • $\begingroup$ Can you post the data set you use? $\endgroup$ – rcollyer Apr 28 '15 at 18:42
  • $\begingroup$ @rcollyer dropbox.com/s/sq9f5iikh3cw8wd/xyz.csv?dl=0 $\endgroup$ – andrewmh20 Apr 28 '15 at 19:07
  • $\begingroup$ many of your data values are fractions, which become strings on a simple Import. Try doing N@ToExpression@xyz. ( I don't get a with your code crash , but I do get an error that some values are non numeric ) $\endgroup$ – george2079 Apr 28 '15 at 20:30
  • $\begingroup$ @george2079 That doesn't seem to be a problem....because it works for Line[], and when I try that N@ToExpression@xyz I get: ToExpression::esntx: Could not parse 64/25 as input. >> etc. FYI this is the data I'm directly graphing after manipulating the previously imported data. $\endgroup$ – andrewmh20 Apr 28 '15 at 21:44
3
$\begingroup$

Ok, I reproduced the crash ( v10/Linux). You have a huge amout of data almost all of which is out of the plot range. Try Select ing only the required points:

 xyz = N@ToExpression[Import["xyz.csv"]];
 Length@xyz  (* 150000 *)
 Length@Select[ xyz , 300 < #[[1]] < 600 & ] (* 117 *)

Now this works.

 Style[Show[
      ListPointPlot3D[Select[ xyz , 300 < #[[1]] < 600 & ], 
      PlotRange -> {{420, 460}, {-1, 1}, {0, 10}}], 
      Graphics3D[Tube[Select[ xyz , 300 < #[[1]] < 600 & ]]]], 
      Antialiasing -> False]

enter image description here

Note it doesn't look like a "tube" because of the aspect ratio of the plot, but that's a different question

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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