# Changing the units in an axis

I have a TH1F histogram, which is divided in another TH1F one (efficiency). I have the Y axis with units from 0 to 1 in jumps of 0.2. I want to make it to be an axis of 0 - 100 in jumps of 20. It’s efficiency and I want it in %. How can I do that?

I try to use the TGaxis, so I defined a new axis, and after a long time I even got it set to place and just in the correct size, but how can I take the other axis off (I mean the original Y axis of the histogram)?

[quote=“Aye”]I have a TH1F histogram, which is divided in another TH1F one (efficiency). I have the Y axis with units from 0 to 1 in jumps of 0.2. I want to make it to be an axis of 0 - 100 in jumps of 20. It’s efficiency and I want it in %. How can I do that?[/quote]What about to mulitply it by 100:

```void TH1::Divide(const TH1 *h1, const TH1 *h2, Double_t c1, Double_t c2, Option_t *option) { // -*-*-*Replace contents of this histogram by the division of h1 by h2*-*-* // ============================================================== // // this = c1*h1/(c2*h2) //```

To turn off an axis you can do:

``````   hpx->GetYaxis()->SetLabelSize(0);
hpx->GetYaxis()->SetTickLength(0);``````

[quote]What about to mulitply it by 100:

```void TH1::Divide(const TH1 *h1, const TH1 *h2, Double_t c1, Double_t c2, Option_t *option) { // -*-*-*Replace contents of this histogram by the division of h1 by h2*-*-* // ============================================================== // // this = c1*h1/(c2*h2) //```
[/quote]

When I just try to multiply I get this kind of error:
error: invalid operands of types `double' and`TH1F*’ to binary `operator*’

If I try for the divid with c1 (see code here) I get:

``` Double_t number = 0.01; Eta_dist->Divide( Ref_Eta_dist, number ); ```
error: no matching function for call to `TH1F::Divide(TH1F*&, Double_t&)’
/afs/cern.ch/sw/lcg/external/root/5.12.00/slc4_ia32_gcc345/root/include/TH1.h:152: note: candidates are: virtual void TH1::Divide(TF1*, Double_t)
/afs/cern.ch/sw/lcg/external/root/5.12.00/slc4_ia32_gcc345/root/include/TH1.h:153: note: virtual void TH1::Divide(const TH1*)
/afs/cern.ch/sw/lcg/external/root/5.12.00/slc4_ia32_gcc345/root/include/TH1.h:154: note: virtual void TH1::Divide(const TH1*, const TH1*, Double_t, Double_t, const Option_t*)

But I did managed to take the other axis off.

I have one more question about adding an axis. Is there a better way to put an axis in the Y-axis possition then guessing (and trying) its (xmin, ymin) and the same for (xmax, ymax) ?

TGaxis have no getters for the axis position because the axis position should be specified at creation time so they are known by the program creating TGaxis… May be I missunderstood this question.

It’s ok, I managed to take the Y-(original-)axis off, and now it’s perfect.
Thank you very much for your help!