# Scaling contour plot colors over several orders of magnitude

I have this contour plot that has values ranging from ~0.01 to ~100, however, there aren't distinct colors between every order of magnitude. I've tried putting a Log scale on the ColorFunction, scaling my data with a Log, and playing with ColorFunctionScaling, but none of these got me color distinctions between orders of magnitude.

ContourPlot[1/100 E^(x + y), {x, -1, 5}, {y, -1, 5},
Contours -> {.01, .1, 1., 10., 100.}, ContourStyle -> None,
ColorFunctionScaling -> True,
ColorFunction -> (ColorData["SiennaTones"]), PlotRange -> All,
PlotLegends -> True]

In this plot, every order of magnitude is a different color, but the difference is only very slight between 0.01 and 0.1, and still subtle between 0.1 and 1. I'd like to be able to see all of them distinctly.

• Could you simply plot Log[f[x,y]] instead of f[x,y]? Jul 27 '19 at 12:21

contours = {.01, .1, 1., 10., 100.};
colors = ColorData["SiennaTones"] /@ Subdivide[Length @ contours];

ContourPlot[1/100 E^(x + y), {x, -1, 5}, {y, -1, 5},
Contours -> contours, ContourStyle -> None,
PlotRange -> All, PlotLegends -> True]

Alternatively, discretize the ColorFunction argument:

discretize = Total[UnitStep[# - contours]] / Length[contours]&;

ContourPlot[1/100 E^(x + y), {x, -1, 5}, {y, -1, 5},
Contours -> contours, ContourStyle -> None,
ColorFunctionScaling -> False,
ColorFunction -> (ColorData["SiennaTones"][discretize@#]&),
PlotRange -> All, PlotLegends -> True]

An alternative way to discretize the color function argument:

ClearAll[pw]