# Adjusting contrast of a color scale with ListDensityPlot

I am using ListDensityPlot to plot data of the form {{x1,y1,z1},{x2,y2,z2}, …}. It results in the plot shown below. But I'd like to adjust the color scale contrast to better show the variations in the low-Z parts (in blue). Basically, I need more color variations for the low Z values (below ~30) and less color variations for larger values.

I've tried a log scale, but it does not show the contract sufficiently. Thanks for the help.

Here is a simplified version of the code I am using:

colorbar[{min_, max_}, colorFunction_: Automatic, divs_: 100] := DensityPlot[
y, {x, 0, 0.2}, {y, min, max},
PlotPoints -> {2, divs},
ColorFunction -> colorFunction,
AspectRatio -> 10,
MaxRecursion -> 0,
FrameTicks -> {None, Automatic},
FrameLabel -> {"", "Z"}];

MyData = Import["DataFileXYZ.dat", "Table"];

MyColorBar :=  Show[colorbar[
{Min[Transpose[MyData][[3]]], Max[Transpose[MyData][[3]]]},
"Temperature"]];

MyPlot :=  ListDensityPlot[
MyData,
ColorFunction -> Function[{height},
ColorData["Temperature"][height]],
FrameLabel -> {"X", "Y"}]

Row[Show[#, ImageSize -> {Automatic, 600}] & /@ {MyPlot, MyColorBar}]


Data file I used is here: https://www.dropbox.com/s/y1oqx8kv5o39ter/DataFileXYZ.txt?dl=0

• Welcome to Mathematica.SE! I suggest the following: 0) Browse the common pitfalls question 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the faq! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! – Dr. belisarius Feb 11 '15 at 20:08
• Please provide a data sample. – Kuba Feb 11 '15 at 22:21
• Have you tried different colour schemes? Maybe "Rainbow" or "BrightBands". Have you tried a gamma correction instead of a log? Have you tried a ListContourPlot and specify the contours you want? – wxffles Feb 11 '15 at 23:27
• Hi @wxffles, different color schemes have the same problems. No sure how to apply a gamma correction in this case. And finally, I am already using ListContourPlot for other specific values, and I can't over crowd the plot with contours to show details in the blue part of the densityplot. Thanks for the help – sguillot Feb 12 '15 at 0:15

Clear[gamma];

In your colorbar you plot MyScale@y and in the plot ColorFunction you have MyScale@height, and then: