How to draw a TH2F Histogram with less-dense dots without re-generating it

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided

I have a root file with a big TH2F histogram. I want to draw the histogram by scaling down the dot density by 1/10 or 1/100 somehow, without regenerating a new TH2F. It is more of a qualitative plot than anything else. Right now, both parts of the distribution appear to the eye to be very dense, but one part has far more data points than the other does. If I scaled the entire histogram down by 1/10 or 1/100 you could see that one part of the distribution is more dense than the other part.

At the above link I see "The number of “Nodes” can be changed with n(nodesx,nodesy) . "

Is this what I am looking for?

Any help is much appreciated!! Thank you!

Maybe you could try to use DrawNormalized for both histograms.

There is only one histogram TH2F, with two regions (think two lumps). One is much less dense than the other but both of them look dense.

You could try: gPad->SetLogz(1);
If this doesn’t help, try another drawing option.

I do not want to put the histogram on log scale. What other draw option do you suggest?

I’m afraid I don’t really understand what your problem is.

You can use TH2::Rebin2D, if you like.

You can also play with the “SPEC” drawing option (and its “operators”), of course.

Here’s a bit of one of the histograms 02%20PM it is very dense as you can see. I just want to scale the histogram such that the dots are less dense looking and you can see shapes in the distribution. How do you use TH2::Rebin2d?

There are quite many drawing options supported for 2D histograms which use a color scale varying with bins’ contents (so there is no need to rely on the drawn dots’ density).

For some TH2::Rebin2D examples, see the “${ROOTSYS}/test/stressHistogram.cxx” file and: ROOT Forum -> search -> Rebin2D

DrawNormalized suggested by Wile_E_Coyote should exactly do
what you want assumed you use the argument “Norm” correctly:

Double_t tnorm(Double_t scale = 10.)
	auto cc = new TCanvas("cc", "cc", 600,600);
	auto h2 = new TH2F("hpxpy", "hpxpy", 50, -50, 50, 50,-50, 50);
	Double_t x,y;
	for (Int_t i=0; i< 100000; i++) {
		h2->Fill(-20+x*5, 20+y*5);
		if (i%10 ==0) {
			h2->Fill(15+x*5, -15+y*5);
	Double_t sow = h2->GetSumOfWeights();
//	h2->Draw();
	h2->DrawNormalized("", sow / scale);
	return sow;


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.