I would like to plot a function of three variables, say for example:
$$f(x,y,z) = x^2+y^3+z^4$$
over $[-1, +1]$. I want my plot to use colors and maybe contours to make this visualization possible using a single plot. Any ideas? Example code would help a lot!
EDIT
I would like to have the $xy$ axes shown and $z$ as a "dynamic" variable (with sliding bar) and the output as a flat, colored contour map.
Answer
Manipulate[
ContourPlot[x^2 + y^3 + z^4, {x, -1, 1}, {y, -1, 1}, ColorFunction -> "DarkRainbow"]
,{z, -1, 1}]
EDIT:
A few values in 3D plot:
Plot3D[Evaluate@Table[x^2 + y^3 + z^4, {z, {0, 0.8, 1}}], {x, -1, 1}, {y, -1, 1}, PlotStyle -> {Red, Green, Blue}]
But I'd rather put a few contour plots next to each other. In general take a look at the Mathematica help, there are lots of examples. You'll also find more options, like ColorFunctionScaling
With[{z = 0},
ContourPlot[x^2 + y^3 + z^4, {x, -1, 1}, {y, -1, 1},
ColorFunction -> "DarkRainbow",
PlotLegends -> BarLegend[Automatic]]
]
Comments
Post a Comment