Creating denoised histogram

Hello Rooters,
I am trying to generate a TwoD histogram with some drawing option which should give me something like
following

denoised

Could you please suggest the required drawing option.

Thanks and with Regards,

Hi,

Try colz option: https://root.cern/doc/master/classTHistPainter.html#HP14

Regards,
Sergey

I seems to me that the real question is how to “denoise” / “smooth” the histogram (for drawing purposes).

If the question is how to get a nice “smooth” colour map, see “Color palettes” and “High quality predefined palettes” in the TColor class reference.

Hi,
I had tried colz but it does not give “denoised/smooth” view for drawing purpose.
Is there any way to “denoised/smooth” the histogram.

Yes, I really need the “denoise / smooth” histogram.
By change the color palettes, i may be able to get histogram with different color.
But the how to “denoise/smooth” it.

Hi
could you show us what you get (and dont like).

One way let binned data look smoother
is to increase the number of bins i.e.make BinWidth smaller.
You could also try to convert it to a TGraph2D
Otto

Hi,
Currently what i am getting is something like this

Can be reproduced using following code

{
   TCanvas *c2e = new TCanvas("c2e","c2e",600,400);
   TH2F *h2e = new TH2F("h2e","TH2 drawn with option E",40,-4,4,40,-20,20);
   Float_t px, py;
   for (Int_t i = 0; i < 25000; i++) {
      gRandom->Rannor(px,py);
      h2e->Fill(px,5*py);
   }
   h2e->Draw("colz");
   return c2e;
}

What i want is its denoise version

![hist|598x375](upload://jEiCaOVk3CtWWwV9OCfIN93UFgr.png) 

Try TH2::Smooth and then some CONTour drawing option.

Thanks a lot.
I think TH2::Smooth followed by CONT drawing option is the one that i was looking for.

Thanks a lot

att a trial with TGraph2D seen from above and TH2 option CONT,
note the increased Nof Contours and the FrameBackground
Also you might try different Color Palettes
Otto

tsmooth.C (1.2 KB)

1 Like

@OSchaile TGraph2D *g2 = new TGraph2D(h2e);

1 Like

“Man lernt immer noch was dazu,
auch wenn alt wird wie eine Kuh”

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