0
$\begingroup$

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:

Heat Map

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?

$\endgroup$
  • 1
    $\begingroup$ "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? $\endgroup$ – J. M.'s discontentment Aug 6 '16 at 11:04
  • $\begingroup$ Of course, I just wasn't aware how to add them. Thank you. $\endgroup$ – phytab Aug 6 '16 at 15:36
4
$\begingroup$
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. enter image description here

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]]]}]

enter image description here

| improve this answer | |
$\endgroup$
  • $\begingroup$ Do you know how I can mark specific point? $\endgroup$ – phytab Aug 6 '16 at 15:39
  • $\begingroup$ @phytab I'm not sure I understand what you mean. $\endgroup$ – Feyre Aug 6 '16 at 15:43
  • $\begingroup$ 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. $\endgroup$ – phytab Aug 6 '16 at 15:56
  • $\begingroup$ @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. $\endgroup$ – Feyre Aug 6 '16 at 16:07
  • 1
    $\begingroup$ @phytab Ok, and here I had just finished my example :), I'll add it anyway. $\endgroup$ – Feyre Aug 6 '16 at 16:27

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.