Skip to content

Commit 57565ef

Browse files
committed
[tgaxis] add epsilon for ticks counts
When caclucating number of extra ticks which need to be placed on left or right side of axis add `epsilon` to avoid possible rounding problems. Ensure that minor tick on very begin or very end of axis range is painted
1 parent 89051d5 commit 57565ef

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

graf2d/graf/src/TGaxis.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1730,7 +1730,7 @@ void TGaxis::PaintAxis(Double_t xmin, Double_t ymin, Double_t xmax, Double_t yma
17301730

17311731
if (fFunction) axis_length0 = binLow-wmin;
17321732
if ((!optionNoopt || optionInt) && axis_length0) {
1733-
nticks0 = Int_t(axis_length0/dxtick);
1733+
nticks0 = Int_t(axis_length0/dxtick + epsilon);
17341734
if (nticks0 > 1000) nticks0 = 1000;
17351735
xtick0 -= dxtick; // skip first major tick which already was drawn
17361736
for (k=1; k<=nticks0; k++) {
@@ -1775,7 +1775,7 @@ void TGaxis::PaintAxis(Double_t xmin, Double_t ymin, Double_t xmax, Double_t yma
17751775

17761776
if (fFunction) axis_length1 = wmax-binHigh;
17771777
if ((!optionNoopt || optionInt) && axis_length1) {
1778-
nticks1 = int(axis_length1/dxtick);
1778+
nticks1 = int(axis_length1/dxtick + epsilon);
17791779
if (nticks1 > 1000) nticks1 = 1000;
17801780
xtick1 += dxtick; // skip last major tick which was already drawn
17811781
for (k=1; k<=nticks1; k++) {

0 commit comments

Comments
 (0)