Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

- Implement the option X+ and Y+ for reverse axis on TGraph. #8131

Merged
merged 1 commit into from
May 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README/ReleaseNotes/v626/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ From now on, the likelihoods are normalized by the sum of integrals in each rang

## 2D Graphics Libraries

- Implement the option `X+` and `Y+` for reverse axis on TGraph.


## 3D Graphics Libraries

Expand Down
20 changes: 14 additions & 6 deletions hist/histpainter/src/TGraphPainter.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -3992,8 +3992,10 @@ void TGraphPainter::PaintGraphReverse(TGraph *theGraph, Option_t *option)

Bool_t lrx = opt.Contains("rx");
Bool_t lry = opt.Contains("ry");
Bool_t lxp = opt.Contains("x+");
Bool_t lyp = opt.Contains("y+");
Bool_t axis = opt.Contains("a");
opt.ReplaceAll("a", "");
opt.ReplaceAll("a", "0");

Double_t LOX = theHist->GetXaxis()->GetLabelOffset();
Double_t TLX = theHist->GetXaxis()->GetTickLength();
Expand All @@ -4013,7 +4015,7 @@ void TGraphPainter::PaintGraphReverse(TGraph *theGraph, Option_t *option)
theHist->GetYaxis()->SetLabelOffset(999.);
theHist->GetYaxis()->SetAxisColor(gPad->GetFrameFillColor());
}
theHist->Paint("0");
theHist->Paint(opt.Data());
}

Int_t N = theGraph->GetN();
Expand Down Expand Up @@ -4051,10 +4053,13 @@ void TGraphPainter::PaintGraphReverse(TGraph *theGraph, Option_t *option)
GL = (YA2 - YA1) / (gPad->GetY2() - gPad->GetY1());
optax.Append("W");
}
Double_t ypos;
if (lxp) ypos = gPad->GetUymax();
else ypos = gPad->GetUymin();
auto *theNewAxis = new TGaxis(gPad->GetUxmax(),
gPad->GetUymin(),
ypos,
gPad->GetUxmin(),
gPad->GetUymin(),
ypos,
theGraph->GetXaxis()->GetXmin(),
theGraph->GetXaxis()->GetXmax(),
theHist->GetNdivisions("X"),
Expand Down Expand Up @@ -4084,9 +4089,12 @@ void TGraphPainter::PaintGraphReverse(TGraph *theGraph, Option_t *option)
GL = (XA2 - XA1) / (gPad->GetX2() - gPad->GetX1());
optax.Append("W");
}
auto *theNewAxis = new TGaxis(gPad->GetUxmin(),
Double_t xpos;
if (lyp) xpos = gPad->GetUxmax();
else xpos = gPad->GetUxmin();
auto *theNewAxis = new TGaxis(xpos,
gPad->GetUymax(),
gPad->GetUxmin(),
xpos,
gPad->GetUymin(),
theGraph->GetYaxis()->GetXmin(),
theGraph->GetYaxis()->GetXmax(),
Expand Down