本文整理汇总了C++中TLatex::GetX方法的典型用法代码示例。如果您正苦于以下问题:C++ TLatex::GetX方法的具体用法?C++ TLatex::GetX怎么用?C++ TLatex::GetX使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TLatex
的用法示例。
在下文中一共展示了TLatex::GetX方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: writeLatex
// write some TLatex text. Return value is new position after the text
double writeLatex(TPad* pad, double x, double y, std::string text, double scale = 1.)
{
//pad->Update();
pad->cd();
TLatex *tl = new TLatex(NDCtoUserX(pad,x), NDCtoUserY(pad,y), text.c_str());
tl->SetTextSize(.040*scale);
tl->Draw();
cout << "latex: " << tl->GetXsize() << " " << tl->GetX() << " " << tl->GetYsize()
<< " pad: " << pad->GetX1() << " " << pad->GetX2() << endl;
return (x+tl->GetXsize()/(pad->GetX2()-pad->GetX1()));
}
示例2: drawSpectra2D
//.........这里部分代码省略.........
setLegendPosition(leg, legendPosition, c, height, width, legendOffsetX, legendOffsetY);
leg->Draw();
}
// add Text
TLatex* latex = 0;
if (nTextLines > 0) {
latex = new TLatex();
latex->SetTextFont(textFont);
latex->SetTextSize(textSize);
setTextAlignment(latex, textPosition);
std::vector<std::pair<float,float>> textCoordinates = calcTextCoordinates(textLines, textPosition, c, textOffsetX, textOffsetY);
for (int i = 0; i<nTextLines; ++i) {
float x = textCoordinates.at(i).first;
float y = textCoordinates.at(i).second;
latex->DrawLatexNDC(x, y, textLines.at(i).c_str());
}
}
// add Text above the pad
TLatex* latexOverPad = 0;
if (nTextsOverPad > 0) {
latexOverPad = new TLatex();
latexOverPad->SetTextFont(textAbovePadFont);
latexOverPad->SetTextSize(textAbovePadSize);
for (int i = 0; i < nTextsOverPad; ++i) {
int textOverPadAlignment = GRAPHICS::textAlign;
if (nTextsOverPadAlignments == 1) textOverPadAlignment = GraphicsConfigurationParser::ParseTextAlign(textsOverPadAlignments.at(0));
else if (nTextsOverPadAlignments == nTextsOverPad) textOverPadAlignment = GraphicsConfigurationParser::ParseTextAlign(textsOverPadAlignments.at(i));
latexOverPad->SetTextAlign(textOverPadAlignment);
setTextAbovePad(latexOverPad, c, textAbovePadOffsetX, textAbovePadOffsetY);
latexOverPad->DrawLatexNDC(latexOverPad->GetX(), latexOverPad->GetY(), textsOverPad.at(i).c_str());
}
}
// add TLine
TLine* line_horizontal[nTLines_horizontal];
for (int iLine = 0; iLine<nTLines_horizontal; ++iLine) {
// draw horizontal line
double xmin = h[i]->GetXaxis()->GetBinLowEdge(h[i]->GetXaxis()->GetFirst());
double xmax = h[i]->GetXaxis()->GetBinLowEdge(h[i]->GetXaxis()->GetLast()+1);
int lineStyle_horizontal = GRAPHICS::lineStyle_horizontal;
if (nLineStyles_horizontal == 1)
lineStyle_horizontal = GraphicsConfigurationParser::ParseLineStyle(lineStyles_horizontal.at(0));
else if (nLineStyles_horizontal == nTLines_horizontal)
lineStyle_horizontal = GraphicsConfigurationParser::ParseLineStyle(lineStyles_horizontal.at(iLine));
line_horizontal[iLine] = new TLine(xmin, TLines_horizontal.at(iLine), xmax, TLines_horizontal.at(iLine));
line_horizontal[iLine]->SetLineStyle(lineStyle_horizontal); // https://root.cern.ch/doc/master/TAttLine_8h.html#a7092c0c4616367016b70d54e5c680a69
line_horizontal[iLine]->Draw();
}
// add TLine
TLine* line_vertical[nTLines_vertical];
for (int iLine = 0; iLine<nTLines_vertical; ++iLine) {
// draw vertical line
double ymin = h[i]->GetYaxis()->GetBinLowEdge(h[i]->GetYaxis()->GetFirst());
double ymax = h[i]->GetYaxis()->GetBinLowEdge(h[i]->GetYaxis()->GetLast()+1);
int lineStyle_vertical = GRAPHICS::lineStyle_vertical;
if (nLineStyles_vertical == 1)
lineStyle_vertical = GraphicsConfigurationParser::ParseLineStyle(lineStyles_vertical.at(0));
else if (nLineStyles_vertical == nTLines_vertical)
lineStyle_vertical = GraphicsConfigurationParser::ParseLineStyle(lineStyles_vertical.at(iLine));