How could I go about creating a heatmap?

Hello
What would be the best way to create a heat map of variables using root? The x and y axes would be lists of the variable names and the values would be some calculated quantity between the two variables (such as covariance).
This seems to cover setting words in the axis tick labels:
[ROOT: TGaxis Class Reference]
And the COLor option outlined here:
[ROOT: THistPainter Class Reference]
Is close to what I want, but I would need to be able to set each bin to a single numerical value.
I could not find anything for a heatmap on the forums.
Thanks,
Alex

You can use TH2::SetBinContent.

1 Like

It seems you are looking for a TH2 with alphanumeric labels as shown is this example. To fill the histogram can use SetBinContent as suggested by @dastudillo . In the example I mentioned the histogram is plotted with the option TEXT. Use the option COLZ instead in order to get a heatmap. ROOT offers a wide collection of predefined palettes. You might find one you like.