# Heat map from data file

I have a file with data arranged in the following way:

...

0.051 0.056 0.269639

0.051 0.057 0.252626

0.051 0.058 0.23856

...

I'd like to plot an heat map and I've managed something like this:

ListDensityPlot[  Import["\HeatMap.txt", "Data"],   PlotRange -> All, ColorFunction -> Hue]


Wich gives me:

The problem is that I don't know what the colors are corresponding to in terms of values. Can I mark colors for specific value ranges? Or how can I find out how the color gradient is comparing to the values?

Also, there is a particular point of interest in the data, how can I show it?

• "colors for specific value ranges" - why not use Blend[]? "find out how the color gradient is comparing to the values" - that's what legends are for, no? – J. M. is in limbo Aug 6 '16 at 11:04
• Of course, I just wasn't aware how to add them. Thank you. – phytab Aug 6 '16 at 15:36

ListDensityPlot[{{1, 1, 1, 1}, {1, 2, 1, 2}, {1, 1, 3, 1}, {1, 2, 1,
4}}, PlotLegends -> Automatic,
ColorFunction -> (Blend[{Yellow, Red}, #] &)]


Generates labels where the values in the plot range between Yellow and Red.

You can check the colour for the scale:

Blend[{Yellow, Red}, 0.5]


For instance gives the colour for the median value.

This epilogue finds the lowest value, (which in this case is of course not unique, but I needed an easy dataset)

data = Table[
With[{r = RandomReal[{0, 5}],
t = RandomReal[{0, 2 Pi}]}, {r Cos[t], r Sin[t],
Sin[r^2]/r^2}], {10^4}];
ListDensityPlot[data, PlotRange -> All,
ColorFunction -> (Blend[{Yellow, Red}, #] &),
Epilog -> {Black, PointSize -> 0.01,
Point[Flatten[MinimalBy[data, Last]][[1 ;; 2]]]}]


• Do you know how I can mark specific point? – phytab Aug 6 '16 at 15:39
• @phytab I'm not sure I understand what you mean. – Feyre Aug 6 '16 at 15:43
• In your picture, let's say I wanted to mark the point (2.0,2.0) with a black dot. How could I do that? Or have it always mark the (x,y) that gives the lowest z for example. – phytab Aug 6 '16 at 15:56
• @phytab You could do something like {Black, Yellow, Yellow, Orange, Orange, Red, Red}, or say {Yellow, Yellow, Black, Orange, Orange, Red, Red} to have a small band at $3/7\pm 1/14$ at the range of values be black. – Feyre Aug 6 '16 at 16:07
• @phytab Ok, and here I had just finished my example :), I'll add it anyway. – Feyre Aug 6 '16 at 16:27