I am trying to scale a histogram (TH1F)
but after applying the scale , it write it as point not histogram
TH1F * h = new TH1F(“h0”,“h0”,6000, 0,6000);
Double_t scale = 0.1;
scale.pdf (19.9 KB)
ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided
what do you mean with “as point”?
Did you try to re-draw it with the “HIST” option?
thank you for replying,
yes I draw it but still gives me points, I attached for the scaled histogram
scale.pdfscale.pdf (19.9 KB)
I think I do not get this. Could you share a reproducer?
I tried the same with some histogram I have. It works fine when using the HIST option as @Pnine suggested:
root  TH1F *h =(TH1F*)hsimple.Get("hpx");
root  Double_t scale = 0.1;
root  h->Scale(scale);
root  h->Draw(); /// produce a plot with error bars
root  h->Draw("HIST"); /// produce a normal histogram plot
Note that you do not need to book the histogram. You need only a pointer.
thank you for replying.
and it work as new Pad, but in the root file where I use
it is not working and plot as error bars.
I have two machines one with root5 (Ubuntu), and one with root6 (mac)
I ran the same code and input file on both machines (root 5 and 6).
I have this issue only with root 6 .
I have attached both spectra before and after scaling
scale6.pdf (21.3 KB)
scale5.pdf (16.5 KB)
Yes, this works perfectly
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.