1
$\begingroup$

I'm plotting a function that is in a module and depends on three variables with ParametricPlot3D, and I'm using a color function for the surface. I want to add a bar to the side that has the values of the height z next to the colors it's assigning to the surface. The closest I've found to what I want is this command:

PlotLegends -> 
 BarLegend[{ColorData[{"TemperatureMap", "Reverse"}], {0, 1}}]

However, I don't have the minimum and maximum values of the surface, and I don't know if there's a way to either display the values automatically or find the maximum and minumum values of the plot (I've already tried with FindMaximum and FindMinimum but it doesn't work).

$\endgroup$
2
$\begingroup$

The default for ColorFunctionScaling is True so the color scale is automatically adjusted to the z values

ParametricPlot3D[
 {Cos[u], Sin[u] + Cos[v], 2 (1/2 + Sin[v])},
 {u, 0, 2 π}, {v, -π, π},
 ColorFunction -> ColorData[{"TemperatureMap", "Reverse"}],
 PlotLegends -> Automatic]

enter image description here

$\endgroup$
1
  • 1
    $\begingroup$ I got it now, Thank you! $\endgroup$ – maggie May 8 '20 at 16:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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