HypoTestInverterPlot: Change Axis Label

Hello experts,
Is there a way to change the axis label in a HypoTestInverterPlot? I looked into the documentation and the class does not have any members along the lines of GetXaxis()->SetTitle("Energy [keV]"). Is there something I am missing or is it simply not possible to change axis labels for this class?

Best regards!

According to the doc MakePlot returns a TGraphErrors. Something like…

TGraphErrors g = H->Makeplot(....);
g->GetXaxis()->SetTitle("Energy [keV]");

… should work.

Thank you, I didn’t catch that the first time reading through it.
Maybe you can help me with my follow-up question: I already understood that I need to add the expected CLs and the observed CLs to a TMultiGraph, but this does not transfer the horizontal line for the confidence limit and the legend from the HypoTestInverterPlot. Is there a way to add them to the TMultiGraph?

I do not fully understand what you mean here. May be @moneta has an idea.

If you want to change the label on the axis drawn by the HypotestINverter plot, and not redo all the plots done in HypoTestInverterPlot::Draw() you can do it by accessing the underlined used TGraph object. They are store in the global list of TROOT. So what you can do is:

gROOT->GetList()->ls();  // to be sure we are using the right names afterwards
auto graph = ((TGraph*)gROOT->FindObject("CLs_observed"));
graph->GetXaxis()->SetTitle("Energy [KeV]");


1 Like