Variable histogram title

Consider declaring a 1D histogram like

TH1D* hist = new TH1D("Stats", "Temp. per day at 12 in 1988; Day; Temperature [#circC]", 
			366, 0, 366);

Is it possible to include parameters in the title setting part? This is part of a function that takes an hour (12 in this case) and a year (1988) and draws a histogram.

Yes, use Form:

TH1D* hist = new TH1D("Stats", Form("Temp. per day at %d in %d; Day; Temperature [#circC]", h,y), 
			366, 0, 366);
1 Like

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