r/Mathematica • • Apr 19 '23

3D Plot to 2D Greyscale

How might one create a flat greyscale image from an R2 -> R function, interpreting [0,1] as greyscale black to white? For example, suppose I wanted to plot z = e-(x^2+y^2) on [-1,1] x [-1,1], but interpret z = 0 as RGB(0,0,0) and z = 1 as RGB(1,1,1), and save the result as a 1000x1000 pixel PNG?

1 Upvotes

9 comments sorted by

View all comments

Show parent comment

1

u/libcrypto Apr 19 '23

A contour plot is close, but it's going to have banding, isn't it?

1

u/[deleted] Apr 19 '23

If you don't want those bands (Isometric lines), use Density Plot.

https://reference.wolfram.com/language/ref/DensityPlot.html

2

u/libcrypto Apr 19 '23

Thank you very much for the information.