Here is what I can say: to make a 3d plot with the color scheme you want and then give it a label, you can in fact rely on another answer I posted to the question "ShowLegend values". The steps are as follows:
From the linked answer, copy the second code block (below the heading Color bar legend) defining the functions trimPoint
, all the way down to display
, and execute them in your notebook. These definitions are used to arrange information about a plot as a legend.
Now we'll make your example plot with some nice colors.
Here I've chosen the SunsetColors
scheme from the Palettes > Color Schemes
menu. You could make your own scheme using Blend
.
plot = Plot3D[Sin[4 x]*Cos[4 y], {x, -2, 2}, {y, -2, 2},
ColorFunction -> "SolarColors"]
- Next, make the labeled plot.
The information we need for the label is the range of z
values to which the colors correspond, and the color function. The other numbers are relative dimensions of the plot versus label:
With[{
range = {-1, 1},
plotWidth = .8,
labelHeight = .5,
labelWidth = .15
},
display[{
plot // at[{0, 0}, plotWidth],
colorLegend[ColorData["SolarColors"], range, Contours -> 8] //
at[{0.85, .1}, Scaled[{labelWidth, labelHeight}]]},
AspectRatio -> .75]
]
The commands display
and at
are explained in the answer linked above.
The rest is to export this plot as a suitable image (I guess). That would be
Export["image.png",%]
An alternative to using my display
function for the legend is to hand-craft your own legend using the general approaches in the answers to "Spreading colors in ListDensityPlot". The reason I wrote my solution was so the legending process can be automated more. In my earlier answer, I had also defined a function reportColorRange
that can automatically keep track of the range of colors and function values, but it only works for 2D plots because the ColorFunction
option in 3D takes additional arguments that I didn't make any provisions for.