My issue is the resulting plot is heavily convoluted when drawing using ‘same’. The generation of the TH1s is handled by a separate function so access to the Fill aspect is not possible. TStackedHisto is not what I am looking for, each TH1 should be independent.
Thanks kindly,
By ‘create a TGraphErrors or a TGraph from histogram’ do you mean generate a TFit and the plot it with the corresponding parameters? Or is there another method that retains the bin structure of a TH1 in a TGraph?
Yes, but a single point ‘amplitude’ for each bin could be extracted (I do not know how to do this. GetBinContent() in a loop over the axis range?) then the central value of each bin and the amplitude would provide the same structure that would be lost in fitting. Is this feasible?
Yes you can do that: you define the x value of each point equal to the bin center and the y value as the bin content. But you will loose the concept of bin
Thank you, I will try this. Maybe the bin structure could be retained by storing the amplitude (y) twice. Once with x=BinCenter-BinWidth/2 and once with x=BinCenter+BinWidth/2, plotting with option “L” (no “P”) and a second function along the y=0 line, filling the area between. I think this should still look like a TH1 but be a TGraph.
Thanks for your assistance.
But to do that the best is really to use a THStack and plot it with option option NOSTACK … (as @Wile_E_Coyote said ) it is exactly what you are looking for… no need to go to graphs.
It is not quite what I need as the overlapping region of multiple semi-Gaussian distributions becomes very convoluted. My goal is to separate the different TH1s along the Z direction so they are comparable without overlapping each other.
Histograms in a thstack plotted as lines with option nostack is exactly the same as multigraph. Of course do what you want. I was just pointing to what, seems to me, is much simpler
The usual method to shade the enclosed area using SetFillColor or SetFillColorAlpha and “F” in the draw options does not result in a filled area. I have tried adding an additional point at the end of the vectors so the first and last points are the same. Enclosing the area however this does not help.
Ok. I do not see a way to implement this functionality with my level of ROOT proficiency. Can I submit a request for the “L3D” Draw() mode be made compatible with the other TGraph Draw() modes, specifically “F”?