Rotate axis labels


is there an option to rotate the axis labels (for e.g. about 90 degrees so they will be aligned vertically) ?

Thank you!

(Duplicated) Check:

Thank you!

So h->LabelsOption(“v”); is what I am looking for. But it does not work, either via i[/i] nor via i[/i].
Is there something that has to be set previously/additionally ?

It depends on the type of labels you have (alphanumeric or not). Please post a small code reproducer of your problem.

It is, finally just numerical:

(…) TCanvas* c=new TCanvas("c","Compare",1400,1000); gStyle->SetOptStat(0); gStyle->SetPadGridX(kTRUE); gStyle->SetPadGridY(kTRUE); TFile *Outputfile=new TFile(outputfile_root, "RECREATE"); c->Divide(2,1); TH2D *U_against_SN_before = new TH2D("U_against_SN_before", "U_{bias}", bins, down, up, bins, down, up); U_against_SN_before->Fill(SN[n], Ubias[n]); c->cd(1); U_against_SN_before->GetXaxis()->SetTitle("SN"); U_against_SN_before->GetYaxis()->SetTitle("U_{bias}"); U_against_SN_before->SetMarkerStyle(8); U_against_SN_before->SetMarkerSize(0.5); U_against_SN_before->LabelsOption("v", "X"); U_against_SN_before->Draw("");

SN is something like 0912009913
and Ubias 353.638682453

It is not that important, I’m just wondering (but I guess for the future it could help at some point to know how to do it).
Thank you in advance!

You cannot rotate the labels if they are numeric.


The workaround is to define char labels, check:

Ok, thank you!

Just forgot to answer in the past… :slight_smile:

You are welcome. By the way, the second link of my previous post should read: Alphanumeric TGraph labels

note also the new fonctionality :