# ContourPlot - ColorFunctionScaling does not help to get ColorFunction properly

I have a ContourPlot where every contour should be displayed with a different color

ContourPlot[
-((2500*Sqrt[13]*(x - 10000)*x^2*y)/(15625*x^4 - 13*(x - 10000)^2*y^2)),
{x, 35, 100},
{y, 1.4, 5.6},
PlotLegends -> Automatic,
Contours -> 20,
ColorFunction -> "DarkRainbow"
]


but I get this output

it looks like the ColorFunction does not work. So I tried to add ColorFunctionScaling->False

which gives me this output

As you can see there is a difference but not what I was expecting. I tried to use ColorFunctionScaling->True as well which gives me the same output as I had in the beginning.

• It appears that your function is relatively invariant to the first two arguments. Without the actual function (or at least a minimal example that also demonstrates this behavior) it is difficult to offer much help. – Bob Hanlon Aug 30 '20 at 16:15
• Thanks for your comment. I managed to add the function to the question. – Arjihad Aug 30 '20 at 17:53
• {min, max} = #[{f[x, y], 35 <= x <= 100, 1.4 <= y <= 5.6}, {x, y}] & /@ {MinValue, MaxValue} and Plot3D[f[x, y], {x, 35, 100}, {y, 1.4, 5.6}, PlotRange -> All, PlotPoints -> 100, MaxRecursion -> 5] show that your function is relatively flat except in one corner that distorts the range of the argument fed to ColorFunction – Bob Hanlon Aug 30 '20 at 18:26

I think the problem comes from the large values near the singularity in your function at the upper left. The default choice of contour colors seems to be using much more of the range than it shows in the plot by default.

A work around is to specify the range in the color function.

With[{min = 0, max = 20},
ContourPlot[-((2500*Sqrt[13]*(x - 10000)*x^2*y)/(15625*x^4 -
13*(x - 10000)^2*y^2)), {x, 35, 100}, {y, 1.4, 5.6},
PlotLegends -> Automatic, Contours -> 20,
PlotRange -> {min, max},
ColorFunctionScaling -> False,
ColorFunction -> (ColorData[{"DarkRainbow", {min, max}}])
]
]