# How To Scale TGraph X-Axis

**URL:** <https://root-forum.cern.ch/t/how-to-scale-tgraph-x-axis/18056>\
**Category:** ROOT\
**Created:** [August 14, 2014, 2:53pm UTC](https://root-forum.cern.ch/t/how-to-scale-tgraph-x-axis/18056 "2014-08-14T14:53:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Brandon.Soubasis](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/b/f14d63/32.png) [@Brandon.Soubasis](https://root-forum.cern.ch/u/Brandon.Soubasis)\
**Post date:** [August 14, 2014, 2:53pm UTC](https://root-forum.cern.ch/t/how-to-scale-tgraph-x-axis/18056/1 "2014-08-14T14:53:55Z")

</div>

Hi Root Experts,

I am plotting a TGraph and would like to scale the x-axis by a number. That is, I would like to multiply every x-axis point by some value. Is this possible?

Any help would be greatly appreciated,  
Brandon

---

<div class="post-metadata">

**Author:** ![jfcaron](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/j/7c8e57/32.png) [@jfcaron](https://root-forum.cern.ch/u/jfcaron)\
**Post date:** [August 14, 2014, 3:01pm UTC](https://root-forum.cern.ch/t/how-to-scale-tgraph-x-axis/18056/2 "2014-08-14T15:01:24Z")

</div>

See this previous post:

[url][Changing the scale for graph?](https://root-forum.cern.ch/t/changing-the-scale-for-graph/17339/1)

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [August 14, 2014, 3:08pm UTC](https://root-forum.cern.ch/t/how-to-scale-tgraph-x-axis/18056/3 "2014-08-14T15:08:29Z")

</div>

In case you’d like to a play with histogram, see also:

> [@Can we shift histogram for several channels?](https://root-forum.cern.ch/t/can-we-shift-histogram-for-several-channels/12050/2):
>
> I’m not sure if this is fully kosher, but suit yourself : #include "TAxis.h" #include "TH1.h" #include "TArrayD.h" Double\_t ScaleX(Double\_t x) { Double\_t v; v = 10 \* x + 100; // "linear scaling" function example return v; } Double\_t ScaleY(Double\_t y) { Double\_t v; v = 20 \* y + 200; // "linear scaling" function example return v; } Double\_t ScaleZ(Double\_t z) { Double\_t v; v = 30 \* z + 300; // "linear scaling" function example return v; } void ScaleAxis(TAxis \*a, Double\_t (…
