How to plot axis with label of percentage?

Hi all,
Could I Draw axis with label like “1% 2% … 100%” with root?

What are your data? Graph? histogram ?
There are several ways:

  • histogram with alphanumeric labels,
  • Custom labels on graph.
  • ChangeLabel,
  • Specify the X title sith %

thanks

May be if you give more details about you data we can provide you a more precise answer.

as the code below:

void p3_all()
{
  TCanvas * c1 = new TCanvas();
  c1->DrawFrame(0,0,2,2);
  TGaxis * g1 = new TGaxis(2,0,2,2,0,100,510,"+");
  g1->SetLineColor(kRed);
  g1->SetLabelColor(kRed);
  g1->SetLabelOffset(0.034);
  g1->SetLabelSize(0.02);
  g1->SetTitleColor(kRed);
  g1->SetTitle("[%]");
  g1->SetTitleSize(0.02);
  g1->SetTitleOffset(1.50);
  g1->Draw("same");
}

I want the label of right axis to be “0” to “100%”, not “0” to “100” with unit “[%]”,
It seems theres is no automatically way

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