32 const std::string option,
33 const Double_t factor = 1.0)
39 const Double_t X1 = 0.0 + gPad->GetLeftMargin();
40 const Double_t X2 = 1.0 - gPad->GetRightMargin();
41 const Double_t Y1 = 0.0 + gPad->GetBottomMargin();
42 const Double_t
Y2 = 1.0 - gPad->GetTopMargin();
44 const Double_t w = gPad->XtoPixel(gPad->GetX2());
45 const Double_t h = gPad->YtoPixel(gPad->GetY1());
47 const Double_t w1 = fabs(gPad->XtoPixel(gPad->GetX2()) - gPad->XtoPixel(gPad->GetX1()));
48 const Double_t h1 = fabs(gPad->YtoPixel(gPad->GetY2()) - gPad->YtoPixel(gPad->GetY1()));
50 const Double_t mw = 2.0;
51 const Double_t mh = 0.5;
52 const Double_t eps = 0.015;
53 const Double_t ts = gStyle->GetStatFontSize() * factor;
54 const Double_t ch = ts * (w < h ? w : h);
56 Double_t W = (width + mw) * (ch/w1) * factor;
57 Double_t H = (height + mh) * (ch/h1) * factor;
61 if (fc * W > X2 - X1 - 2*eps) { fc *= (X2 - X1 - 2*eps) / W; }
62 if (fc * H >
Y2 - Y1 - 2*eps) { fc *= (
Y2 - Y1 - 2*eps) / H; }
69 Double_t x1 = X2 - W - eps;
70 Double_t y1 =
Y2 - H - eps;
71 Double_t x2 = X2 - eps;
72 Double_t y2 =
Y2 - eps;
74 if (option.find(
'T') != string::npos && option.find(
'B') == string::npos) {
79 if (option.find(
'B') != string::npos && option.find(
'T') == string::npos) {
84 if (option.find(
'R') != string::npos && option.find(
'L') == string::npos) {
89 if (option.find(
'L') != string::npos && option.find(
'R') == string::npos) {
94 TLegend* lg =
new TLegend(x1, y1, x2, y2);
97 lg->SetFillColor(kWhite);
100 lg->SetTextFont(gStyle->GetStatFont());