0
$\begingroup$

In this adaptation of an ancient post ( Placing a ContourPlot under a Plot3D ) I would like to know how to coordinate the colors of the surface on the color of the scheme LightTerrain or any other scheme. In other words, I wonder how to know which colors are used in a scheme.

 f = E^-(x^2 + y^2);

 min = 0;
 max = 1;
  f1 = Plot3D[f, {x, -2, 2}, {y, -2, 2}, PlotRange -> {min, max}, 
  ClippingStyle -> None, MeshFunctions -> {#3 &}, Mesh -> 15, 
  MeshStyle -> Opacity[.5], 
  MeshShading -> {{Opacity[.3], Blue}, {Opacity[.8], LightBlue}}, 
  Lighting -> "Neutral", Boxed -> False];
  slice = SliceContourPlot3D[f, 
  z == min - 2, {x, -2, 2}, {y, -2, 2}, {z, min - 2, min + 1}, 
  PlotRange -> {min, max}, Contours -> 15, Axes -> False, 
  PlotPoints -> 50, PlotRangePadding -> 0, 
  ColorFunction -> "LightTerrain"];
 Show[f1, slice, PlotRange -> All, BoxRatios -> {1, 1, 1}, 
  FaceGrids -> {Back, Left}]

enter image description here

$\endgroup$
2
$\begingroup$

Give this a look:

AssociationMap[Blend["LightTerrain", #1] &, Range[0, 1, .05]]

This is the simplest way to get the actual colors and here's why:

ColorData returns a ColorDataFunction which is really a special InterpolatingFunction-esque object.

In this case we get:

In[622]:= ColorData["LightTerrain"] // InputForm

Out[622]//InputForm=
ColorDataFunction["LightTerrain", "Gradients", {0, 1}, Blend["LightTerrain", #1] & ]

Then look at ColorDataFunction // SubValues to see what this does and it's really only Blend["LightTerrain", #1] & that's important here.

But the gradients defining "LightTerrain" in blend aren't obviously scrapeable. They're probably possible to find, but it's likely not worth it when you can just use the function.

$\endgroup$

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.