I tried
Plot3D[Exp[-x^2 - y^2], {x, -2, 2}, {y, -2, 2},
ColorFunction -> (ColorData["TemperatureMap"][#3] &),
PlotLegends -> Automatic]
in an attempt to add a colorbar legend to the plot, but this did not work. It did work here:
DensityPlot[Exp[-x^2 - y^2], {x, -2, 2}, {y, -2, 2},
ColorFunction -> "SunsetColors",
PlotLegends -> Automatic]
Any suggestions in how I can get it to work in the first bit of code?
Thanks.
PlotLegends -> BarLegend["TemperatureMap"]
. You'd need additional customizations in most cases to make sure the legend matches the plot. $\endgroup$