How to make a smaller histogram form a larger one while preserving the style?


_ROOT Version: 6.19
_Platform: OS 10.14.3


I have a histogram that goes from 200 to 800 with some ~3000 bins, but the relevant data goes from around 300 to 500.

I know I can change the range and only see the relevant part, but I was wondering if I could only have the relevant part.

My approach was:

1.- Select the range of interest
2.- Loop through all bins in that range and put their contents in another histogram

The problem is that the new histogram will not have the same title, labels on the axises, colors, and in general the style will not be the same.
Is there a way in which I could have this new histogram have the same style as the previous one?

Thanks

If you have the code to create the histogram you may have to copy all styles by hand; if you only have the histo you can plot it, save the canvas as a .C file and read the code. You can also check UseCurrentStyle and see if it does what you want.

Maybe you could simply live with:

histo->GetXaxis()->SetRange(binmin, binmax);

The majority of TH1 methods are sensitive to axes ranges which were set like that.

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