The curves are composed by several 2*n nested lists. I want these curves be placed in a 3d way, like the xy plane is for the data, different curves are located in several parallel xy planes with different z values. The graph is similiar to this one. Is there any build in function can draw graphs like this? Plus, how to deal with errorbars?

Thanks a lot for helping. graph example I tried with this simplified data, but I can only got the 2d graph using ErrorListPlot.

data = Table[Table[{{x, a^2 Sum[-Sin[n x]^2 + 1, {n, 1, 10}]},ErrorBar[0, x]}, {x, 2.5, 3.5, 0.01}], {a, 1, 3, 0.5}];
ErrorListPlot[data, PlotRange -> All, AspectRatio ->1/GoldenRatio]

bad example

  • 4
    $\begingroup$ Are you sure that adding error bars to such a plot is a good idea? I feel that they will make this plot completely unreadable and useless... $\endgroup$ Nov 18 '14 at 5:41

I would say you can do something like this to produce a colored plot:

n = 20; m = 12;
DATA[1] = Table[{0, Random[], Random[]}, {j, 1, n}];
For[i = 2, i <= m, i++,
  DATA[i] = 
    DATA[i - 1] + 
     Table[{1/n, RandomReal[{-1, 1}]/20, RandomReal[{-1, 1}]/20}, {j, 
       1, n}];

  {i, 1, m}
 Axes -> True,
 PlotRange -> {{0, 1}, {0, 1}, {0, 1}}

However, that doesn't account for the error bars. The ErrorBarPlots package doesn't seem to have any Graphics3D constructions, which means you might not be able to find an automatic command to do this. I don't see a way to do that that doesn't require us to really just draw all of the error bars by hand, just giving something as complicated (but more or less the same) as what I give above.

  • $\begingroup$ I know this isn't the crux of the question, but wouldn't the data be more simply constructed using FoldList rather than a For loop? i.e. DATA=FoldList[#1+#2&, Table[{0, Random[], Random[]}, {n}], Table[{1/n, RandomReal[{-1, 1}]/20, RandomReal[{-1, 1}]/20}, {m-1},{n}]]. At the very least, the Table construct doesn't require an explicit j iterator. $\endgroup$
    – Verbeia
    Dec 18 '14 at 6:35
  • $\begingroup$ NSure, there are plenty of ways to write this up and get the same output. I'm not a code-golf kind of guy, I tend to write code that isn't optimal and for this type of application I don't see the difference so I wouldn't go back and optimize it. $\endgroup$ Dec 21 '14 at 3:27
  • 1
    $\begingroup$ No idea how that "N" got in there... let's say NSure is the numerical version of Sure... $\endgroup$ Dec 21 '14 at 3:28

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.