Пример #1
0
void splithist(double ratio=0.2){
  TVirtualPad* pmain = TVirtualPad::Pad();
  
  double h = 1. - pmain->GetTopMargin() - pmain->GetBottomMargin();

  double xlow = 0.; //gStyle->GetPadLeftMargin();
  double xhigh = 1.; // - gStyle->GetPadRightMargin();

  double ytop = 1.; //- gStyle->GetPadTopMargin();
  double ybot = 0.; //gStyle->GetPadBottomMargin();
  double ymid = pmain->GetBottomMargin() + ratio * h; //ybot + ratio * (ytop-ybot);
  

  double yp1bot = ymid;
  double yp2top = ymid;

  TPad* p1 = new TPad(TString(pmain->GetName()) + "_1", pmain->GetTitle(),
		      xlow, yp1bot, xhigh, ytop);
  p1->SetNumber(1);
  TPad* p2 = new TPad(TString(pmain->GetName()) + "_2", pmain->GetTitle(), 
		      xlow, ybot, xhigh, yp2top);
  p2->SetNumber(2);
  p1->SetFillStyle(4000);
  p2->SetFillStyle(4000);

  double p1h = ytop - yp1bot;
  double p2h = yp2top - ybot;
  

/*
  p1->SetTopMargin(pmain->GetTopMargin()/p1h);
  p1->SetBottomMargin((ymid-yp1bot)/p1h);
  p1->SetLeftMargin(pmain->GetLeftMargin());
  p1->SetRightMargin(pmain->GetRightMargin());
  
  p2->SetTopMargin((ymid-yp2top)/p2h);
  p2->SetBottomMargin(pmain->GetBottomMargin()/p2h);
  p2->SetLeftMargin(pmain->GetLeftMargin());
  p2->SetRightMargin(pmain->GetRightMargin());
*/
    p1->SetTopMargin(0.11);
    p1->SetBottomMargin(0.);
    p1->SetRightMargin(0.02);
 
    p2->SetTopMargin(0.);
    p2->SetBottomMargin(0.3);
    p2->SetRightMargin(0.02);



  p2->Draw();
  p1->Draw();
  pmain->Modified();

  p1->cd();
}
Пример #2
0
//_______________________________________________________________________________________
static void AddGrid()
{ 
  TVirtualPad *thisPad = qPad();

  if (thisPad) {
 
    TView *view = thisPad->GetView(); 
    if (!view) return;
    Double_t min[3],max[3];
    view->GetRange(min,max);

    TList *list      = thisPad->GetListOfPrimitives();
    TString histName = thisPad->GetName();
    TH2F *m_DummyHist = 0; 
    const Char_t *dummyName = "Axis3D";
    histName += dummyName;
    m_DummyHist = list->FindObject(histName.Data());
    if (!m_DummyHist) { 
      m_DummyHist = new TH2F(histName.Data(),"",1,min[0],max[0],1,min[1],max[1]);
      m_DummyHist->SetDirectory(0);
      m_DummyHist->Draw("surf,same");
    }
    m_DummyHist->GetXaxis()->SetLimits(min[0],max[0]);
    m_DummyHist->GetYaxis()->SetLimits(min[1],max[1]);
    m_DummyHist->GetZaxis()->SetLimits(min[2],max[2]);
 
    thisPad->Modified();
    thisPad->Update();
  }
}