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?

  • 1
    $\begingroup$ Please provide any code you've already written and we can show you how to fix it. $\endgroup$
    – C. E.
    Oct 25, 2013 at 11:22

1 Answer 1

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


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.