diff --git a/hist/histpainter/src/TGraphPainter.cxx b/hist/histpainter/src/TGraphPainter.cxx index eb51453dd2bb6..e12da9fe59652 100644 --- a/hist/histpainter/src/TGraphPainter.cxx +++ b/hist/histpainter/src/TGraphPainter.cxx @@ -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+"); @@ -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()) { @@ -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 @@ -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()) { @@ -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(); @@ -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); } @@ -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 @@ -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);