Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
import from ref axes instead of cloned ones
use new graph option I to do the hiding of regular axes
  • Loading branch information
paulgessinger committed Sep 2, 2016
commit 38f5c705d9f55adf5195b97eeb0ce8e85cb54544
37 changes: 15 additions & 22 deletions graf2d/gpad/src/TRatioPlot.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -653,11 +653,11 @@ void TRatioPlot::Draw(Option_t *option)
fLowerPad->cd();

if (fShowConfidenceIntervals) {
fConfidenceInterval2->Draw("A3");
fConfidenceInterval2->Draw("IA3");
fConfidenceInterval1->Draw("3");
fRatioGraph->Draw(fGraphDrawOpt+"SAME");
} else {
fRatioGraph->Draw("A"+fGraphDrawOpt+"SAME");
fRatioGraph->Draw("IA"+fGraphDrawOpt+"SAME");
}
} else {

Expand All @@ -676,7 +676,7 @@ void TRatioPlot::Draw(Option_t *option)
fLowerPad->cd();

TString opt = fGraphDrawOpt;
fRatioGraph->Draw("A"+fGraphDrawOpt);
fRatioGraph->Draw("IA"+fGraphDrawOpt);

}

Expand Down Expand Up @@ -871,17 +871,6 @@ void TRatioPlot::CreateGridline()

void TRatioPlot::Paint(Option_t * /*opt*/)
{
// hide lower axes
TAxis *refx = GetLowerRefXaxis();
TAxis *refy = GetLowerRefYaxis();

refx->SetTickSize(0.);
refx->SetLabelSize(0.);
refx->SetTitleSize(0.);
refy->SetTickSize(0.);
refy->SetLabelSize(0.);
refy->SetTitleSize(0.);

// create the visual axes
CreateVisualAxes();
CreateGridline();
Expand Down Expand Up @@ -1230,10 +1219,13 @@ void TRatioPlot::CreateVisualAxes()
}

// import infos from TAxis
ImportAxisAttributes(fUpperGXaxis, fSharedXAxis);
ImportAxisAttributes(fUpperGYaxis, fUpYaxis);
ImportAxisAttributes(fLowerGXaxis, fSharedXAxis);
ImportAxisAttributes(fLowerGYaxis, fLowYaxis);
ImportAxisAttributes(fUpperGXaxis, GetUpperRefXaxis());
ImportAxisAttributes(fUpperGYaxis, GetUpperRefYaxis());
ImportAxisAttributes(fLowerGXaxis, GetLowerRefXaxis());
ImportAxisAttributes(fLowerGYaxis, GetLowerRefYaxis());

// lower x axis needs to get title from upper x
fLowerGXaxis->SetTitle(fUpperGXaxis->GetTitle());

// (re)set all the axes properties to what we want them
fUpperGXaxis->SetTitle("");
Expand Down Expand Up @@ -1340,10 +1332,11 @@ void TRatioPlot::CreateVisualAxes()
}

// import attributes from shared axes
ImportAxisAttributes(fUpperGXaxisMirror, fSharedXAxis);
ImportAxisAttributes(fUpperGYaxisMirror, fUpYaxis);
ImportAxisAttributes(fLowerGXaxisMirror, fSharedXAxis);
ImportAxisAttributes(fLowerGYaxisMirror, fLowYaxis);
ImportAxisAttributes(fUpperGXaxisMirror, GetUpperRefXaxis());
ImportAxisAttributes(fUpperGYaxisMirror, GetUpperRefYaxis());
ImportAxisAttributes(fLowerGXaxisMirror, GetLowerRefXaxis());
ImportAxisAttributes(fLowerGYaxisMirror, GetLowerRefYaxis());


// remove titles
fUpperGXaxisMirror->SetTitle("");
Expand Down
4 changes: 2 additions & 2 deletions tutorials/hist/ratioplot2.C
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ void ratioplot2() {
c1->Clear(); // Fit does not draw into correct pad
auto rp1 = new TRatioPlot(h1);
rp1->Draw();
rp1->GetLowYaxis()->SetTitle("ratio");
rp1->GetUpYaxis()->SetTitle("entries");
rp1->GetLowerRefYaxis()->SetTitle("ratio");
rp1->GetUpperRefYaxis()->SetTitle("entries");
c1->Update();
}