Sign up ×

In physics, we regularly deal with observables, which are functions $f(x,y,z)$ of the position vector $\vec r = (x,y,z)$. How, do you plot such a function?

For functions $y=f(x)$ of 1 parameter, we use regular $x$-$y$ line or scatter plots. (These are sometimes called 2D plots.)

For functions $z=f(x,y)$ of 2 parameters, we can use contour/density or surface plots (and modern plotting tools render them nicely.) The latter are often called 3D plots.

For functions $f(x,y,z)$, I'm at a loss. How do I plot/visualize a three-dimensional density? The best approach I have seen so far is a set of two 2D-density plots $f(x,0,z)$ and $f(0,y,z)$ for the intersections with the $x$-$z$ and $y$-$z$ plane.

The final plot shall be printable, i.e. convey the message without relying on animation or user interaction.

share|cite|improve this question

closed as off topic by David Z Apr 4 '13 at 20:44


Would e.g. be a better home for this question? –  Qmechanic Apr 4 '13 at 9:53
Print a mostly transparent color 3D plot on a 3D printer, if you want to impress somebody. –  Luboš Motl Apr 4 '13 at 9:57
@Qmechanic: I don't know, that's too Mathematica-specific. The question here is more of how to represent a 3D field in such a way that humans will be able to grasp the form of the field. Which is OK for Math.SE, and sort of OK for here. (may be a good idea to migrate to Math) –  Manishearth Apr 4 '13 at 12:00
Not mathematica specific unless the OP specifically says so. For instance, I would use ROOT (TH3::Draw) tools for this purpose (preferably in a live display so that it can be rotated). –  dmckee Apr 4 '13 at 19:00

2 Answers 2

There are a few ways to do this.

If you are visualizing it on a computer, then draw a density plot that can be rotated, like the one presented here.

Otherwise, plot color-coded dots at well-spaced intervals.

One other idea (which I use at times) is to plot the vector field $f(x,y,z)\hat k$. It's pretty easy to get the gist of a vector field by glancing at a plot like

enter image description here

and this idea can be extended to a scalar field.

share|cite|improve this answer
Nice examples. I was looking for something like your rotatable 2D density plot, which does not rely on user interaction, e.g. 2 or 3 views from different angles combined. –  Jan Apr 4 '13 at 9:38
@Jan: Well, depending on the orientation of the graph, I would just take a few well-placed snapshots :) –  Manishearth Apr 4 '13 at 9:42

There are density plots for visualizing f(x,y,z). You might have seen plot for wave function of electron around So the result is a 3 dimensional gird with smeared fog as the f(x,y,z). fog is thick where f is large and thin where f is small.

ContourPlot3D or ListPointPlot3D routine in mathematica might do the job for you.

or try this

share|cite|improve this answer
Welcome to Physics.SE! Neither of those Mathematica functions will work -- the first may be useful for 2D scalar fields, though. I don't see how to use the second one for a 3D scalar field. The last example (density plot) would work, but it may be worth noting that such density plots only make much sense on a computer -- static plots are hard to read. –  Manishearth Apr 4 '13 at 9:41
