Skip to content

Conversation

couet
Copy link
Member

@couet couet commented Apr 28, 2022

The following example produced a weird plot:

{
   TH2D *blah = new TH2D("","",11,0.079,0.101,8,-0.0075,0.0005);
   for (int i=1; i<=blah->GetNbinsX();i++) {
      for (int j=1; j<=blah->GetNbinsY();j++) blah->SetBinContent(i, j, i*j);
   }
   blah->Draw("ARR");
}

Screenshot 2022-04-28 at 11 20 41

This was because the bin center was shifted by an arbitrary value of 0.03. When the axis dynamic was large compared to 0.03 this was not visible. In the above example, it is not the case and therefore the plot was wrong. Removing that arbitrary shift gives the right plot.

Screenshot 2022-04-28 at 11 44 44

This arbitrary shift comes from the 22 years old FORTRAN version of the code.

@couet couet self-assigned this Apr 28, 2022
@couet couet requested a review from lmoneta as a code owner April 28, 2022 09:46
@phsft-bot
Copy link

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-ubuntu16/nortcxxmod, ROOT-ubuntu2004/soversion, mac1015/python3, mac11/cxx17, windows10/cxx14
How to customize builds

Copy link
Member

@lmoneta lmoneta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM !
Very strange ! Do you know what was the original reason for the 0.03 ?

@couet
Copy link
Member Author

couet commented Apr 28, 2022

No, I do not know. That's the bin center clearly. Why was it shifted? I do not know.
But it fixes the problem and other examples work too.

@couet
Copy link
Member Author

couet commented Apr 28, 2022

I went back to the Fortran and it was already like that. So there is no explanation.

@couet couet merged commit 28c6107 into root-project:master Apr 28, 2022
@couet couet deleted the paintarrow-fix branch September 28, 2023 09:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants