What do you mean by “does not fill properly”? what do you get? It’s better if you show all the code you are trying and what you get. Anyway, the lines you show seem ok, but:
1 - Make sure that energy and flux have values within the x and y ranges of the histo (and I suppose they are getting the values inside a loop).
2 - I don’t think the option “A” is valid when drawing a histogram, so remove that; and instead of “P” try h3->Draw("*"); to see the data points more clearly at least initially.
Thank you @couet and @dastudillo
First I used h3->Draw(“COL”), but later i wished fill the histogram in line/point format. So i tried to use AP option from TGraph , unfortunately it did not work. The “*” option also does not clearly visible.
I like to fill the 2D histogram as:
This kind of plot is not possible with 2D histograms simply because this kind of plot represent unbinned dat whereas 2D histograms are binned data. Use a TGraph instead.