Drawing a kink in Y axis?

Hello everyone,

I am trying to draw a small “kink” in the Y-axis to indicate it does not start from 0
kink_yaxis

I tried this by creating a different TPad and drawing various TLines (again using BrokenAxis.C by @couet ) and resizing it in the GUI. Is there a more precise/efficient way to do this?

Thank You

Can you post some code (we can try) showing what you are doing ?

Hi, Thanks for the reply.

void broken_Y() {
   //Canvas and pad (for histograms) creation
   TCanvas *c = new TCanvas("c", "c",500,500);          

   TPad *p1 = new TPad("p1","p1",0.1,0.1,0.9,0.901);          
   p1->SetBorderMode(0);
   p1->Draw();

   
   // Histograms creation
   auto myHist = new TH1F("h1","",1000,0,1600);
   ---
   ---
   // Histograms filling
   myHist->Fill();
   -----
   -----
        
  //Drawing the histograms
   p1->cd();
   myHist->Draw();
   p1->SetLogy();
  ------
  ------

    //Drawing the kink
   c->cd();
   TPad *b = new TPad("b","b",0.1,0.19,0.8,0.22);
   b->SetBorderMode(0);
   b->Draw();
   b->cd();
   TLine *line = new TLine(0.11,0,0.1105677,0.399656);
   line->Draw();
   line = new TLine(0.1105677,0.5860092,0.11,1);
   line->Draw();
   line = new TLine(0.076639,0.5143349,0.1524797,0.6863532);
   line->Draw();
   line = new TLine(0.076639,0.3423165,0.1524797,0.5143349);
   line->Draw();
}

That’s not run-able … can provide something we can run ? It will be simpler to debug.

Yes, it requires two large root files is it possible to upload them here ?

Thnaks for help.

May be you can just create and fill fake histograms ?

Thank You for your reply. Yes, I think I will be able to reproduce the histogram with dummy values and share the runnable code.

1 Like