Zoom TH1 with mouse wheel - speed is slow

when using TCanvas with a TH1 plotted, the speed of zoom/unzoom by mouse wheel is very very slow, like 0.5% of the range on one scroll. I realized, how useful it can be when using THTTPServer, where the speed in the browser is just optimal.

Is there a way to increase the zoom/unzoom speed? Thank you

On my Mac the zoom with the mouse wheel is as fast as the zoom with a range. It is real time. Unless you have a huge number of bins (like several 1000) I do not see any reason why it could be slow.

Hi Jaromir,

You mention THttpServer. Do you mean zooming speed in the web browser or zooming speed with normal ROOT graphics?


Dear Sergey,
THttpserver is fine. Fast and exactly matches typical needs.
Dear couet,
yes, I have 16000 bins th1 spectrum. Is there any chance to speed up the zoom/unzoom with the wheel?

Thank you

16000 … that must be the problem. Can you send the histogram so I can try ?
The only way to speed it would be to change the code doing the zoom.

Dear couet,
I am sending an example code with a peak few times wided than usual gamma peak.

TH1F *h=new TH1F("h","h",16000,0,16000)
for (int i=0;i<1000;i++){ h->Fill(  gRandom->Gaus(8000,10) );}

Now I point to x-axis and roll…

I have some small hope that I do something not correctly and a bigger worry about the ‘change the code’.

Thank you for your responses,

As I said a code change is required. It is here:

Thanks for having reported this issue.


Thank you, one small and naive question - I guess that it will work now, if I compile root from current git repo. Since I am happy to have the opportunity of precompiled binary ( https://root.cern/download/root_v6.28.04.Linux-ubuntu22-x86_64-gcc11.3.tar.gz )- when could it be available precompiled for ubuntu ?
Thank you, bye

I guess you will need to download it from GitHub and install yourself.

1 Like

@jaromrax I think you can try this nightly build: root_v6.28.99.Linux-ubuntu22-x86_64-gcc11.3.tar.gz

1 Like

Well, I am not sure, if this nightly build Jun 20 2023, 23:44:00; From remotes/origin/v6-28-00-patches@v6-28-04-115-ge1c68d0647 really contains the change. When I check with 10000 bin histogram, it still goes 1 bin at a time. But I dont know the procedures for these builds.

I just merged the fix recently. It is in master now.

1 Like

Thank you,
it works, two small comments
1- it could be a bit faster than 2% of the range
2- if it was sensitive on the position of the cursor, it would become a fantastic tool. I understand that it is not probably easy at all.
Thank you

If you need to zoom-wheel a specific part of the plot, first do a positionnal zoom in order to center the part you need and them use the zoom-wheel.

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