void inBounds(){ gStyle->SetOptStat(0); gErrorIgnoreLevel = kError; TH1::SetDefaultSumw2(); TH1D *h = new TH1D("h", "h", 1000, 0, 10); h->SetMarkerStyle(20); h->SetMarkerColor(kBlue); h->SetLineColor(kBlue); TRandom3 *rn = new TRandom3(1); TCanvas *c1 = new TCanvas(); c1->cd(); for(Int_t r{0}; r < 1000; ++r){ h->Fill(rn->Gaus(5,1)); } h->Draw("e0p"); // move the labels so they don't overlap with the masking boxes, because not sure how to redraw the labels over the boxes h->GetXaxis()->SetLabelOffset(0.01); h->GetYaxis()->SetLabelOffset(0.01); // hide markers clipping outside of the first half of the x-axis TBox *box = new TBox(-0.06, -0.23, (h->GetBinLowEdge(h->GetNbinsX()+1))/2, 0.0); box->SetFillColor(kWhite); box->Draw(); // hide the marker segment clipping the left y-axis TBox *box2 = new TBox(-0.07, -0.23, 0.0, h->GetMaximum()); box2->SetFillColor(kWhite); box2->Draw(); gPad->RedrawAxis(); // gPad->Update(); c1->Print("quick_example.pdf", "pdf"); exit(0); }