Can't get axes titles in TF1

Hello, I used the commands in my macro

f2->GetXaxis()->SetTitle("Ep (eV)");

but I don’t get the titles…

lorfun.cpp (4.7 KB)

Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided

The first plot is f1. You should set the tite on f1.


Hi couet, I modified

lorfun.cpp (4.7 KB)

but I still don’t get the title

lorfun.cpp (4.7 KB)

Thank you @couet it works…I see that you just used
f1->SetTitle without the GetXaxis…but why did it work for you (You attached the pic) and not for me?

Before you did:

f1->GetXaxis()->SetTitle("x title")
f1->SetTitle(); // this erase the X tile

… you can set the 3 titles in one go:

f1->SetTitle("title ; x title ; y title");

Thank you!

good work

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