1
$\begingroup$

I cannot figure how this ListDensityPlot function works.

From the site:

     ListDensityPlot[{{x1,y1,f1},{x2,y2,f2},…}] 

I write

    ListDensityPlot[{{24.5, 20.5, 0.109}, {25.5, 20.5, 0.198}, {26.5, 
    20.5, 0.338}, {27.5, 20.5, 0.53}, {28.5, 20.5, 0.82}, {29.5, 20.5, 
    1.2}}]

and it just gives a completely white plot. Thank you for your help!

$\endgroup$
  • 1
    $\begingroup$ Add option DataRange -> All $\endgroup$ – user18792 Dec 11 '18 at 17:26
  • $\begingroup$ Thanks! Now the plot is not white but it has not sense. On the X-axis it goes from 1.0 to 3.0 while on Y-axis it goes from 1 to 6. It should go, approximatively, from 24 to 30 on the X-axis and from 20 to 21 on the Y-axis no? If I add PlotRange -> All and PlotLegends -> Automatic the problem is not solved. Moreover, the legend (that from my understanding should regards the value of f(x,y)) goes from 0 to 25 while it should go to a maximum of roughly 1.3, no? $\endgroup$ – Knomes Dec 11 '18 at 17:43
4
$\begingroup$

The problem is that all of your points lie along exactly the same line in y. The second coordinate of all of your points is 20.5. Your density plot is thus infinitely thin. Try adding at least one more point that does not lie in the same line. For example:

ListDensityPlot[{{24.5, 20.5, 0.109}, {25.5, 20.5, 0.198}, {26.5, 
  20.5, 0.338}, {27.5, 20.5, 0.53}, {28.5, 20.5, 0.82}, {29.5, 20.5, 
  1.2}, {24.5, 21.5, 0.109}, {25.5, 21.5, 0.198}, {26.5, 21.5, 
  0.338}, {27.5, 21.5, 0.53}, {28.5, 21.5, 0.82}, {29.5, 21.5, 1.2}}]
$\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.