Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix the aspect ratio of plots #77

Open
kratsg opened this issue Jan 23, 2017 · 1 comment
Open

fix the aspect ratio of plots #77

kratsg opened this issue Jan 23, 2017 · 1 comment

Comments

@kratsg
Copy link
Owner Author

kratsg commented May 23, 2017

void DrawTextWithAngle()
{
   auto *C = gPad->GetCanvas();
   Double_t RM = C->GetRightMargin();
   Double_t LM = C->GetLeftMargin();
   Double_t TM = C->GetTopMargin();
   Double_t BM = C->GetBottomMargin();
   Double_t W = Double_t(C->GetWw()*(1.-LM-RM));
   Double_t H = Double_t(C->GetWh()*(1.-TM-BM));

   Double_t A = (180.*TMath::ATan(H/W))/(TMath::Pi());

   auto *t = new TText(0.3,0.3,Form("This text is parallel to the line the angle is %f degrees",A));
   t->SetTextAngle(A);
   t->Paint();
}

void textangle()
{
   auto *C = new TCanvas("C","C", 1600, 1200);
   C->SetRightMargin(0.16);

   auto *h = new TH2F("h","h",20,0.,2500.,20,0.,2500);
   h->Fill(1000.,1000.,123.);
   h->Fill(1500.,1000.,1230.);
   h->Draw("col");
   h->Draw("text45 same");
   auto *l = new TLine(0.,0.,2300.,2300.);
   l->Draw();
   gPad->Update();

   auto *ex = new TExec("ex","DrawTextWithAngle();");
   ex->Draw();
}

macro should allow us to fix up the angle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant