So I've been able to make a list given by

list = Table[{xValues, f[xValues, t (*fixed*)]}, {xValues, xmin, xmax}]

For example:

list = 
 Table[{x, Sin[x/(2*Pi)*1/10]*Cos[1/(2*Pi)]}, {x, 1, 10}]

this list is easily plotted with the command ListPlot[list] (or even ListLinePlot if I wanted some kind of interpolation between my points).

Now if I go to the 3D-case it becomes slightly harder! So I again make my list of data, this time given by:

Plotdata = 
 Table[{x, y, Sin[x/(2*Pi)*1/10]*Cos[y/(2*Pi)*1/10]}, {x, 1, 10}, {y, 
   1, 10}]

This now gives me a nested list, and my attempt to plot it with ListPlot3D is futile. I'm wondering if I need to do something special to get this done? My goal would be to get a nice 3D-plot of the whole.

I know I could do it for my example with the regular Plot3D command, but that's just an example, the real case involves a lot of functions which can't be done by the plot-command (or would demand to much time). My problem comes essentially down to the above. I'm hoping someone could help me.

  • 1
    $\begingroup$ your list is nested; is this what you want: ListPlot3D[Flatten[Plotdata, 1]? (if so, you might want to look at documentation of ListPlot3D) $\endgroup$ Oct 14, 2013 at 13:47
  • $\begingroup$ Well that was what I was thinking first to, but it doesn't give the right plot. I used this example to analyze my mistake because then I can compare with Plot3D[Sin[x]*Cos[y],{x,0,2*Pi},{y,0,2*Pi}]. Using the "Flatten" command doesn't give the same result for the plot. So just applying flatten doens't really solve the problem (unfortunately) $\endgroup$
    – Nick
    Oct 14, 2013 at 13:57
  • 1
    $\begingroup$ Maybe you want to multiply by 2 * Pi instead of divide? $\endgroup$
    – Michael E2
    Oct 14, 2013 at 14:01
  • 1
    $\begingroup$ or just use: Plotdata = Table[{x, y, Sin[x]*Cos[y]}, {x, 0, 2 Pi, 0.1}, {y, 0, 2 Pi, 0.1}] $\endgroup$ Oct 14, 2013 at 14:02
  • 1
    $\begingroup$ @Nick: see Michael's comment $\endgroup$ Oct 14, 2013 at 14:22

1 Answer 1


I have extended your range for illustrative purposes. Two ways:

Plot3D[Sin[x/(2*Pi)*1/10]*Cos[y/(2*Pi)*1/10], {x, 1, 100}, {y, 1, 
  Flatten@Table[{x, y, Sin[x/(2*Pi)*1/10]*Cos[y/(2*Pi)*1/10]}, {x, 1, 
     100, 1}, {y, 1, 100, 1}], 3], Mesh -> 10, 
 MeshFunctions -> {#1 &, #2 &}, BoxRatios -> {1, 1, 0.6}, 
 PlotRange -> All, MaxPlotPoints -> 100]

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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