Using Form() with the SetTitle() while graphing inside loop

Is it somehow possible to use Form() while setting TGraph title using the ‘shorthand’ method

gr->SetTitle ("Form("Graph %d", graph_num); X title; Y title")

Or I need to resort to separate titles for the axes and the total graph?

Thanks a lot

Form uses a static buffer is not advisable in function calls. Instead use TString::Format:

gr->SetTitle (TSring::Format("Graph %d; X title; Y title", graph_num).Data());
1 Like