I have a set of data from temperature sensors in an area, 3 coordinates + a temperature value: {x, y, z, t}. The number of points is not that big, 15-20, so it can be typed directly. I need to create gradient temperature maps from it: It could be a cube similar to what Plot3D does but most important I need a set of 2d sections by different height: z = 0.5, z = 1 etc. (The coordinates are in meters.)

I tried to use ListDensityPlot3D for a cube and ListSliceDensityPlot for sections but I can't find a way to feed it with a fixed set of points all documanted examples are about Table(...) defining a function and an interval.

Any idea how to do this? I'm pretty sure it is a trivial task its just that I use Mathematica once per 2-3 years.


There's no requirement that the data will be given on a grid. It can certainly given at arbitrary locations (but of course you'll have to worry about how good your interpolation is).

Here's a ListSliceDensityPlot3D of 30 random data points:

dat = RandomReal[1, {30, 4}]
ListSliceDensityPlot3D[dat, "CenterPlanes"]

enter image description here

  • $\begingroup$ It helped, thanks! But do you know how to get a flat 2d section and not a cube with sections like the one ListSliceDensityPlot3D provides? I need just images of vertical sections with z = 1, 2 etc. $\endgroup$
    – ElDog
    May 11 '17 at 18:58
  • $\begingroup$ @ElDog just replace "CenterPlanes" by ""ZStackedPlanes" $\endgroup$
    – yohbs
    May 11 '17 at 20:29
  • $\begingroup$ I did it. But what I mean, I need a set of flat images to insert in a document, not a cube with sections. Cube is impressive too and an be used, but I also need images. $\endgroup$
    – ElDog
    May 12 '17 at 7:41
  • 1
    $\begingroup$ In that case you should probably construct an interp=Interpolation[...your data... ] and simply plot it at different z's with whichever function you like, say to plot at z=2 you can do DensityPlot[interp[x, y, 2],... ] $\endgroup$
    – yohbs
    May 12 '17 at 12:44

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.