# TGraph/TMultiGraph yaxis Ndivisions and range

**URL:** <https://root-forum.cern.ch/t/tgraph-tmultigraph-yaxis-ndivisions-and-range/64782>\
**Category:** ROOT\
**Tags:** jsroot\
**Created:** [April 7, 2026, 1:54am UTC](https://root-forum.cern.ch/t/tgraph-tmultigraph-yaxis-ndivisions-and-range/64782 "2026-04-07T01:54:38Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![nsj](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/n/4491bb/32.png) [@nsj](https://root-forum.cern.ch/u/nsj)\
**Post date:** [April 7, 2026, 1:54am UTC](https://root-forum.cern.ch/t/tgraph-tmultigraph-yaxis-ndivisions-and-range/64782/1 "2026-04-07T01:54:39Z")

</div>

Hi,

I am finding that JSROOT ignores the y-axis Ndivisions and SetRangeUser when it loads and displays graphs stored in a root file. Is there a way for me to change that? (I can set the range again in JSROOT using object.fHistogram.fMaximum & fMinimum).

Edit: Next, I found that I can also set the Ndivisions in JSROOT using object.fHistogram.fYaxis.fNdivisions. 🙂

Thanks for your help.  
Naomi.

---

<div class="post-metadata">

**Author:** ![devajith](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/devajith/32/37165_2.png) [@devajith](https://root-forum.cern.ch/u/devajith)\
**Post date:** [April 7, 2026, 5:32am UTC](https://root-forum.cern.ch/t/tgraph-tmultigraph-yaxis-ndivisions-and-range/64782/2 "2026-04-07T05:32:44Z")

</div>

Hi Naomi,

Thanks for your question. Let me add @linev in the loop.

Dev

---

<div class="post-metadata">

**Author:** ![linev](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/l/2bfe46/32.png) [@linev](https://root-forum.cern.ch/u/linev)\
**Post date:** [April 7, 2026, 7:16am UTC](https://root-forum.cern.ch/t/tgraph-tmultigraph-yaxis-ndivisions-and-range/64782/3 "2026-04-07T07:16:53Z")

</div>

Hi Naomi,

Can you provide reproducer of the problem - as ROOT macro or in ROOT file?

Regards,  
Sergey

---

<div class="post-metadata">

**Author:** ![nsj](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/n/4491bb/32.png) [@nsj](https://root-forum.cern.ch/u/nsj)\
**Post date:** [April 7, 2026, 2:25pm UTC](https://root-forum.cern.ch/t/tgraph-tmultigraph-yaxis-ndivisions-and-range/64782/4 "2026-04-07T14:25:35Z")

</div>

The problem was that the y-axis user range (and Ndivisions) stored in the graph in the .root file were ignored when JSROOT drew the graph on my website, it used its defaults. After I wrote my question, I found how to set these again in JSROOT, so I have a workaround. 🙂

I’ll attach one graph that showed this problem when viewed online, its values are all 1 but its possible values are -1,0,1, so I wanted to set the y-axis to show all three as it’s then easier to compare with earlier versions.

Naomi.

[singlegraph.root](https://root-forum.cern.ch/uploads/short-url/cqA4AXZicpzvRghSf0ov4VroqcY.root) (6.2 KB)

---

<div class="post-metadata">

**Author:** ![linev](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/l/2bfe46/32.png) [@linev](https://root-forum.cern.ch/u/linev)\
**Post date:** [April 7, 2026, 2:31pm UTC](https://root-forum.cern.ch/t/tgraph-tmultigraph-yaxis-ndivisions-and-range/64782/5 "2026-04-07T14:31:49Z")

</div>

In your file histogram associated with `TGraph` has fMinimum/fMaximum values set.  
They are -1.4 and 1.4 respectively. So these values overrule all other Y axis settings.

---

<div class="post-metadata">

**Author:** ![linev](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/l/2bfe46/32.png) [@linev](https://root-forum.cern.ch/u/linev)\
**Post date:** [April 7, 2026, 2:45pm UTC](https://root-forum.cern.ch/t/tgraph-tmultigraph-yaxis-ndivisions-and-range/64782/6 "2026-04-07T14:45:07Z")

</div>

And if plot same `TGraph` with plain ROOT - I see very similar result.  
Including configured divisions numbers

---

<div class="post-metadata">

**Author:** ![nsj](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/n/4491bb/32.png) [@nsj](https://root-forum.cern.ch/u/nsj)\
**Post date:** [April 7, 2026, 3:01pm UTC](https://root-forum.cern.ch/t/tgraph-tmultigraph-yaxis-ndivisions-and-range/64782/7 "2026-04-07T15:01:45Z")

</div>

When I use JSROOT to show the graph loaded from the file, those configured settings are lost.

---

<div class="post-metadata">

**Author:** ![linev](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/l/2bfe46/32.png) [@linev](https://root-forum.cern.ch/u/linev)\
**Post date:** [April 7, 2026, 3:21pm UTC](https://root-forum.cern.ch/t/tgraph-tmultigraph-yaxis-ndivisions-and-range/64782/8 "2026-04-07T15:21:23Z")

</div>

[Here link](https://root.cern/js/latest/?file=https://root-forum.cern.ch/uploads/short-url/cqA4AXZicpzvRghSf0ov4VroqcY.root&item=eff_status) how your file shown with latest JSROOT release.

Is it that you see?

---

<div class="post-metadata">

**Author:** ![nsj](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/n/4491bb/32.png) [@nsj](https://root-forum.cern.ch/u/nsj)\
**Post date:** [April 7, 2026, 4:10pm UTC](https://root-forum.cern.ch/t/tgraph-tmultigraph-yaxis-ndivisions-and-range/64782/9 "2026-04-07T16:10:47Z")

</div>

Yes!

Sorry. I had confused it with a TMultiGraph that I built in JSROOT. The graphs (as in my example file) do load perfectly, but I had combined several into a multigraph which used default axis values until I worked out how to set them properly for myself. So my original complaint was wrong and everything is fine. 🙂

It did take me a while to find out how to set the axis settings, so maybe that info will help someone else.

---

<div class="post-metadata">

**Author:** ![linev](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/l/2bfe46/32.png) [@linev](https://root-forum.cern.ch/u/linev)\
**Post date:** [April 7, 2026, 4:25pm UTC](https://root-forum.cern.ch/t/tgraph-tmultigraph-yaxis-ndivisions-and-range/64782/10 "2026-04-07T16:25:26Z")

</div>

One must be careful when building `TMultiGraph` object.  
In JSROOT set `gr.fHistogram = null` for all used graphs or `gr->SetHistogram(nullptr);` in the ROOT. Otherwise graph settings may conflict with settings in `TMultiGraph`.

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [April 21, 2026, 4:26pm UTC](https://root-forum.cern.ch/t/tgraph-tmultigraph-yaxis-ndivisions-and-range/64782/11 "2026-04-21T16:26:01Z")

</div>

Closed on April 21, 2026, 4:26pm UTC

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