Skip to content
Merged
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
30 changes: 22 additions & 8 deletions hist/histpainter/src/TGraphPainter.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -4150,6 +4150,13 @@ void TGraphPainter::PaintGraphReverse(TGraph *theGraph, Option_t *option)
theHist->GetYaxis()->SetLabelOffset(999.);
theHist->GetYaxis()->SetAxisColor(gPad->GetFrameFillColor());
}

// after Unzoom menu command min/max can be 0 and should be reset
if ((theHist->GetMinimum() == theHist->GetMaximum()) && (theHist->GetMinimum() != -1111)) {
theHist->SetMinimum(theGraph->GetYaxis()->GetXmin());
theHist->SetMaximum(theGraph->GetYaxis()->GetXmax());
}

TString opth = "0";
if (lxp) opth.Append("x+");
if (lyp) opth.Append("y+");
Expand Down Expand Up @@ -4213,9 +4220,6 @@ void TGraphPainter::PaintGraphReverse(TGraph *theGraph, Option_t *option)
if (axis) {
// Reverse the X axis
Double_t GL = 0.;
theHist->GetXaxis()->SetTickLength(0.);
theHist->GetXaxis()->SetLabelOffset(999.);
gPad->Update();
TString optax = "-SDH";
if (gPad->GetGridx()) {
if (gPad->GetLogy()) {
Expand Down Expand Up @@ -4258,6 +4262,7 @@ void TGraphPainter::PaintGraphReverse(TGraph *theGraph, Option_t *option)
theReversedXaxis->SetLabelColor(theGraph->GetXaxis()->GetLabelColor());
theReversedXaxis->SetTickLength(TLX);
theReversedXaxis->Paint();
delete theReversedXaxis;
}

// Reverse X coordinates
Expand All @@ -4283,7 +4288,6 @@ void TGraphPainter::PaintGraphReverse(TGraph *theGraph, Option_t *option)
if (axis) {
// Reverse the Y axis
Double_t GL = 0.;
gPad->Update();
TString optax = "-SDH";
if (gPad->GetGridy()) {
if (gPad->GetLogx()) {
Expand All @@ -4298,14 +4302,21 @@ void TGraphPainter::PaintGraphReverse(TGraph *theGraph, Option_t *option)
else xpos = gPad->GetUxmin();
if (gPad->GetLogx()) xpos = TMath::Power(10,xpos);
TGaxis *theReversedYaxis;
Double_t ymin = theHist->GetMinimum();
Double_t ymax = theHist->GetMaximum();
if (ymin == ymax) {
ymin = theGraph->GetYaxis()->GetXmin();
ymax = theGraph->GetYaxis()->GetXmax();
}

if (gPad->GetLogy()) {
optax.Append("G");
theReversedYaxis = new TGaxis(xpos,
TMath::Power(10,gPad->GetUymax()),
xpos,
TMath::Power(10,gPad->GetUymin()),
theGraph->GetYaxis()->GetXmin(),
theGraph->GetYaxis()->GetXmax(),
ymin,
ymax,
theHist->GetNdivisions("Y"),
optax.Data(), GL);
if (theHist->GetYaxis()->GetMoreLogLabels()) theReversedYaxis->SetMoreLogLabels();
Expand All @@ -4314,8 +4325,8 @@ void TGraphPainter::PaintGraphReverse(TGraph *theGraph, Option_t *option)
gPad->GetUymax(),
xpos,
gPad->GetUymin(),
theGraph->GetYaxis()->GetXmin(),
theGraph->GetYaxis()->GetXmax(),
ymin,
ymax,
theHist->GetNdivisions("Y"),
optax.Data(), GL);
}
Expand All @@ -4325,6 +4336,7 @@ void TGraphPainter::PaintGraphReverse(TGraph *theGraph, Option_t *option)
theReversedYaxis->SetTickLength(-TLY);
theReversedYaxis->SetLabelOffset(LOY-TLY);
theReversedYaxis->Paint();
delete theReversedYaxis;
}

// Reverse Y coordinates
Expand Down Expand Up @@ -4355,6 +4367,8 @@ void TGraphPainter::PaintGraphReverse(TGraph *theGraph, Option_t *option)

PaintHelper(theReversedGraph,opt.Data());

delete theReversedGraph;

theHist->GetXaxis()->SetLabelOffset(LOX);
theHist->GetXaxis()->SetTickLength(TLX);
theHist->GetYaxis()->SetLabelOffset(LOY);
Expand Down
Loading