Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm able to plot a 3D plot of a grayscale image using ListPlot3D, where it plots a 3D surface of the image pixel intensity. But I would like not to plot the pixel value below a certain value. In the specific case I'm working on, I want to remove all the pixels with value zero but still plot the pixels that are above zero at there original position. Does anyone knows of how to do this?

share|improve this question
Please provide any code you've already written and we can show you how to fix it. – C. E. Oct 25 '13 at 11:22
up vote 2 down vote accepted
threshold = 0;
f[x_, y_] := Clip[Sin[1/5 x y], {0, 1}]
t = Table[f[x, y], {x, -2 Pi, 2 Pi, .1}, {y, -2 Pi, 2 Pi, .1}];
GraphicsRow@{it = Image@t, ListPlot3D[ImageData@it, PlotRange -> {threshold + 10^-10, 1}, 
                           ClippingStyle -> None, MeshFunctions -> {#3 &}, Mesh -> 5, 
                           ColorFunction -> "SunsetColors"]}

Mathematica graphics

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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