TF1 with custom axis labels (pi axis)

I have a simple TF1 function:

TF1* f = new TF1("f","TMath::Cos(x)",0,TMath::Pi());

Is there any way to transform the x axis labels to pi/4, pi/2, 3pi/4, pi?

I have found only solutions for TGraph, not for TF1?
cern.root.narkive.com/BtOKlS0P/r … boundaries
[How to set custom x-axis labels using a TGraph?

I thought about plotting instead

TF1* f = new TF1("f","TMath::Cos(x/TMath::Pi())",0,1);

So that at least the tick marks are where they should (in submultiples of pi). Could one then modify the existing labels without touching the ticks? How?

Thanks.

{
   TCanvas *c1 = new TCanvas("c1","Test",0,0,700,700);
   TFile *example = new TFile("hsimple.root");
   hpx->Draw();
   hpx->GetXaxis()->SetBit(TAxis::kLabelsHori);
   hpx->GetXaxis()->SetBinLabel(10,"-#pi");
   hpx->GetXaxis()->SetBinLabel(50,"0");
   hpx->GetXaxis()->SetBinLabel(90,"+#pi");
}

Thanks for the answer. For TF1, I figured out that you have to call f->GetHistogram()->GetXaxis() …

However, the suggested solution erases all tick marks. Is there any way to retain the tick marks? In other words, could I make in the hpx histogram somehow the substitution of labels
{-4,-3,-2,-1,0,1,2,3,4} --> {-4pi,-3pi,-2pi,-pi,0,pi,2pi,3pi,4pi} without affecting the axis tick marks? Just modifying the text-labels.

Thanks.

{
   Double_t pi = TMath::Pi();
   TF1*   f = new TF1("f","TMath::Cos(x/TMath::Pi())", -pi, pi);
   TH1*   h = f->GetHistogram();
   TAxis* a = h->GetXaxis();
   a->SetBit(TAxis::kLabelsHori);
   a->SetBinLabel(1,"-#pi");
   a->SetBinLabel(50,"0");
   a->SetBinLabel(100,"+#pi");
   a->SetBit(TAxis::kLabelsHori);
   a->SetLabelSize(0.075);
   f->Draw();
   gPad->Update();

   TGaxis* ax = new TGaxis(-pi, gPad->GetUymin(),
                            pi, gPad->GetUymin(),
                           -pi, pi, 510, "");
   ax->SetLabelSize(0.);
   ax->Draw();
}

See also the new feature:
root.cern.ch/doc/master/classTGaxis.html#GA10a