Hello, I need to write a text on x-axis of a Tmulti-graph (i.e. a text instead of numbers).
I mean…I’m plotting the energy loss for unit of thickness in several mulit-target materials (H, He, Li, Be, C) therefore I want the chemical symbols on the x-axis instead of number (1,2,3,4,5)
I wrote the macro using
mg->GetHistogram()->GetXaxis()->SetBinLabel(bin1,"H_{2}");
gPad->Update();
mg->GetXaxis()->ChangeLabel(bin1, 45, 0.02, 31, -1, -1,Form("H_{2}"));
gPad->Update();
mg->GetXaxis()->ChangeLabel(bin2, 45, 0.02, 31, -1, -1,Form("He"));
gPad->Update();
mg->GetXaxis()->ChangeLabel(bin3, 45, 0.02, 31, -1, -1,Form("Li"));
gPad->Update();
mg->GetXaxis()->ChangeLabel(bin4, 45, 0.02, 31, -1, -1,Form("Be"));
gPad->Update();
mg->GetXaxis()->ChangeLabel(bin5, 45, 0.02, 31, -1, -1,Form("C"));
but I get empty x-axis
Here macro and data files
dedxmat.cpp (3.1 KB)
Edep_dx_materials_tar01.txt (117 Bytes)
Edep_dx_materials_tar02.txt (112 Bytes)
Thank you and happy 2022!
Please read tips for efficient and successful posting and posting code
ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided