# Cut log-y axes in JSROOT

**URL:** <https://root-forum.cern.ch/t/cut-log-y-axes-in-jsroot/58226>\
**Category:** ROOT\
**Tags:** jsroot\
**Created:** [February 20, 2024, 7:37pm UTC](https://root-forum.cern.ch/t/cut-log-y-axes-in-jsroot/58226 "2024-02-20T19:37:46Z")\
**Posts on this page:** 11\
**Page:** 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:** [February 20, 2024, 7:37pm UTC](https://root-forum.cern.ch/t/cut-log-y-axes-in-jsroot/58226/1 "2024-02-20T19:37:47Z")

</div>

I have some TProfile histograms with the y-axis spanning 6 orders of magnitude or so.  
I can see the whole contents when I draw them with “log-y” in the standard ROOT (in a standard TCanvas).  
But when I draw them in “JSROOT” with “log-y”, the axes are “cut” to 1 to 4 orders of magnitude (I then need to click each “Y axis” and “Unzoom” it).  
It seems to me that “JSROOT” (“7.5.4” and “dev”) erratically tries to optimize the “log-y” ranges.  
How can I force it to stay away from them?

---

<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:** [February 21, 2024, 8:10am UTC](https://root-forum.cern.ch/t/cut-log-y-axes-in-jsroot/58226/2 "2024-02-21T08:10:24Z")

</div>

You always can do `SetMinimum()`/`SetMaximum()` to fix Y range in the histogram.

Can you provide TProfile which makes a problem for you - I will try to check that is wrong

---

<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:** [February 21, 2024, 8:17am UTC](https://root-forum.cern.ch/t/cut-log-y-axes-in-jsroot/58226/3 "2024-02-21T08:17:16Z")

</div>

I get a complete ROOT file with various canvases, each with several pads where these histograms are drawn (with “log-y”).  
When I open this file in the standard ROOT, everything is fine when I draw these canvases (e.g., in the standard TBrowser). I just need a way to punch the JSROOT not to try to be too clever.

---

<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:** [February 21, 2024, 9:00am UTC](https://root-forum.cern.ch/t/cut-log-y-axes-in-jsroot/58226/4 "2024-02-21T09:00:03Z")

</div>

Please attach file here.

---

<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:** [February 21, 2024, 9:58am UTC](https://root-forum.cern.ch/t/cut-log-y-axes-in-jsroot/58226/5 "2024-02-21T09:58:58Z")

</div>

Actually I can reproduce problem with simple TProfile example:

[https://jsroot.gsi.de/latest/?file=../files/hsimple.root&item=hprof;1&opt=logy](https://jsroot.gsi.de/latest/?file=../files/hsimple.root&item=hprof;1&opt=logy)

I will try to improve it

---

<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:** [February 21, 2024, 10:05am UTC](https://root-forum.cern.ch/t/cut-log-y-axes-in-jsroot/58226/6 "2024-02-21T10:05:53Z")

</div>

Note that you get 2 orders more than needed (below actual data), while I get 4 orders too few (the values of the data are gone from the plot):  
y-axis 5e-2 to 20 for the actual data 1e-6 to 2e-1  
y-axis 1 to 10 for the actual data 10 to 4e5

---

<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:** [February 21, 2024, 10:27am UTC](https://root-forum.cern.ch/t/cut-log-y-axes-in-jsroot/58226/7 "2024-02-21T10:27:45Z")

</div>

Now should be better:

[https://jsroot.gsi.de/dev/?file=../files/hsimple.root&item=hprof;1&opt=logy](https://jsroot.gsi.de/dev/?file=../files/hsimple.root&item=hprof;1&opt=logy)

It will be released soon as version `7.6.0`

---

<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:** [February 21, 2024, 10:34am UTC](https://root-forum.cern.ch/t/cut-log-y-axes-in-jsroot/58226/8 "2024-02-21T10:34:41Z")

</div>

I tried your “dev”, no change for my plots.

---

<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:** [February 22, 2024, 7:22am UTC](https://root-forum.cern.ch/t/cut-log-y-axes-in-jsroot/58226/9 "2024-02-22T07:22:24Z")

</div>

In your canvas there are custom values in pad ranges - probably from previous drawings.  
JSROOT tries to use them - and produces wrong result.

In this aspect JSROOT behaves differently from plain ROOT.  
I need to change this behavior - but it will takes some time and I will do it after 7.6.0 release.

---

<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:** [February 22, 2024, 7:41am UTC](https://root-forum.cern.ch/t/cut-log-y-axes-in-jsroot/58226/10 "2024-02-22T07:41:15Z")

</div>

Well, my plots come from a running DAQ, so they are “updated” at regular intervals (it is then possible that some initial ranges are automatically set at startup).

When you change this behavior, please check that all types of plots are handled (i.e., not just the TProfile, where we noticed it).

---

<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:** [March 12, 2024, 9:10pm UTC](https://root-forum.cern.ch/t/cut-log-y-axes-in-jsroot/58226/12 "2024-03-12T21:10:15Z")

</div>

Your today’s (2024.03.12) commits fix this problem. Many thanks.
