2
$\begingroup$

I have defined a function

FreeEnergy[x,y],

which I want to plot in 3D. It is a function involving numerical integrals. When I make a flattened table

a = Flatten[Table[{i, j, FreeEnergy[i, j]}, {i, 10^(-11), 10^(-10), 10^(-11)}, 
{j, 0.01, 0.1, 0.01}], 1]

I get triples of numbers, like so:

a = {{1/100000000000, 0.01, 418.254}, {1/100000000000, 0.02, 332.037}, 
{1/100000000000, 0.03, 290.103}, {1/100000000000, 0.04, 263.607}, 
{1/100000000000, 0.05, 244.735}, {1/100000000000, 0.06, 230.324}, 
{1/100000000000, 0.07, 218.805}, {1/100000000000, 0.08, 209.294}, 
{1/100000000000, 0.09, 201.249}, {1/100000000000, 0.1, 194.315}, 
{1/50000000000, 0.01, 131.97}, {1/50000000000, 0.02, 104.813}, 
{1/50000000000, 0.03, 91.6048}, {1/50000000000, 0.04, 83.2588}, 
{1/50000000000, 0.05, 77.3145}, {1/50000000000, 0.06, 72.7753}, 
{1/50000000000, 0.07, 69.1469}, {1/50000000000, 0.08, 66.1511}, 
{1/50000000000, 0.09, 63.6171}, {1/50000000000, 0.1, 61.4331}, 
{3/100000000000, 0.01, 67.3045}, {3/100000000000, 0.02, 53.4881}, 
{3/100000000000, 0.03, 46.7681}, {3/100000000000, 0.04, 42.522}, 
{3/100000000000, 0.05, 39.4977}, {3/100000000000, 0.06, 37.1882}, 
{3/100000000000, 0.07, 35.3422}, {3/100000000000, 0.08, 33.818}, 
{3/100000000000, 0.09, 32.5288}, {3/100000000000, 0.1, 31.4176}, 
{1/25000000000, 0.01, 41.7954}, {1/25000000000, 0.02, 33.2413}, 
{1/25000000000, 0.03, 29.0808}, {1/25000000000, 0.04, 26.4519}, 
{1/25000000000, 0.05, 24.5794}, {1/25000000000, 0.06, 23.1496}, 
{1/25000000000, 0.07, 22.0066}, {1/25000000000, 0.08, 21.0629}, 
{1/25000000000, 0.09, 20.2647}, {1/25000000000, 0.1, 19.5767}, 
{1/20000000000, 0.01, 28.9173}, {1/20000000000, 0.02, 23.0198}, 
{1/20000000000, 0.03, 20.1513}, {1/20000000000, 0.04, 18.3388}, 
{1/20000000000, 0.05, 17.0478}, {1/20000000000, 0.06, 16.062}, 
{1/20000000000, 0.07, 15.2739}, {1/20000000000, 0.08, 14.6233}, 
{1/20000000000, 0.09, 14.0729}, {1/20000000000, 0.1, 13.5985}, 
{3/50000000000, 0.01, 21.4262}, {3/50000000000, 0.02, 17.0739}, 
{3/50000000000, 0.03, 14.9569}, {3/50000000000, 0.04, 13.6192}, 
{3/50000000000, 0.05, 12.6664}, {3/50000000000, 0.06, 11.9388},
{3/50000000000, 0.07, 11.3572}, {3/50000000000, 0.08, 10.877}, 
{3/50000000000, 0.09, 10.4708}, {3/50000000000, 0.1, 10.1206}, 
{7/100000000000, 0.01, 16.6463}, {7/100000000000, 0.02, 13.2798}, 
{7/100000000000, 0.03, 11.6423}, {7/100000000000, 0.04, 10.6075}, 
{7/100000000000, 0.05, 9.8705}, {7/100000000000, 0.06, 9.30765}, 
{7/100000000000, 0.07, 8.85772}, {7/100000000000, 0.08, 8.48621}, 
{7/100000000000, 0.09, 8.17195}, {7/100000000000, 0.1, 7.90109}, 
{1/12500000000, 0.01, 13.3903}, {1/12500000000, 0.02, 10.6953}, 
{1/12500000000, 0.03, 9.3843}, {1/12500000000, 0.04, 8.55586}, 
{1/12500000000, 0.05, 7.96575}, {1/12500000000, 0.06, 7.51509}, 
{1/12500000000, 0.07, 7.15484}, {1/12500000000, 0.08, 6.85736}, 
{1/12500000000, 0.09, 6.60572}, {1/12500000000, 0.1, 6.38882}, 
{9/100000000000, 0.01, 11.0619}, {9/100000000000, 0.02, 8.84689}, 
{9/100000000000, 0.03, 7.76938}, {9/100000000000, 0.04, 7.08843}, 
{9/100000000000, 0.05, 6.60336}, {9/100000000000, 0.06, 6.2329}, 
{9/100000000000, 0.07, 5.93675}, {9/100000000000, 0.08, 5.6922}, 
{9/100000000000, 0.09, 5.48532}, {9/100000000000, 0.1, 5.307}, 
{1/10000000000, 0.01, 9.3328}, {1/10000000000, 0.02, 7.4742}, 
{1/10000000000, 0.03, 6.56999}, {1/10000000000, 0.04, 5.99852}, 
{1/10000000000, 0.05, 5.59142}, {1/10000000000, 0.06, 5.2805}, 
{1/10000000000, 0.07, 5.03193}, {1/10000000000, 0.08, 4.82666}, 
{1/10000000000, 0.09, 4.653}, {1/10000000000, 0.1, 4.50331}}.

Trying to plot this data with ListPlot3D returns an empty graph, while ListPointPlot3D works. Why? Help much appreciated.

$\endgroup$
1
  • $\begingroup$ I haven't seen this problem before, but if you post a complete example (i.e. provide wither the function or the data) then someone will surely figure it out. Without any way to reproduce it, it's unlikely there will be an answer. $\endgroup$
    – Szabolcs
    Feb 20, 2015 at 14:42

3 Answers 3

3
$\begingroup$

As Michael Stern states, the issue seems to be with the scale of the numbers. Rescaling the x axis allows to show the Plot. You can specify the ticks to show the actual numbers you had in the dataset.

a[[All, 1]] = 10^11 N[a[[All, 1]]]
labels = {#, # 10^-11} & /@ a[[All, 1]] // Union
(*{{1., 1.*10^-11}, {2., 2.*10^-11}, {3., 3.*10^-11}, {4., 
  4.*10^-11}, {5., 5.*10^-11}, {6., 6.*10^-11}, {7., 7.*10^-11}, {8., 
  8.*10^-11}, {9., 9.*10^-11}, {10., 1.*10^-10}}*)
ListPlot3D[a, Ticks -> {labels, Automatic, Automatic}]

Mathematica graphics

$\endgroup$
3
  • $\begingroup$ Thank you very much! Will definitely use this trick. $\endgroup$
    – drabus
    Feb 20, 2015 at 15:17
  • $\begingroup$ @drabus Also use PlotRange->All in this solution because some data points are not shown. Or refer to my answer which does not need rescaling. $\endgroup$ Feb 20, 2015 at 15:20
  • $\begingroup$ A similar more general solution can be found in mathematica.stackexchange.com/a/146120/45020. $\endgroup$
    – Kvothe
    Oct 20, 2021 at 15:28
2
$\begingroup$

I have run into this before when dealing with very small numbers as you do here. One solution is to rescale your data and then, if you need to, adjust the ticks.

So if your nested list is saved under the variable name a,

ListPlot3D[a]

fails, but

a[[All, 1]] = a[[All, 1]]*10^6;
ListPlot3D[a]

works.

$\endgroup$
2
$\begingroup$

ListPlot3D[a, DataRange -> All, PlotRange -> All] works for me.

$\endgroup$

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.