本文整理汇总了C++中TPaveLabel::SetTextFont方法的典型用法代码示例。如果您正苦于以下问题:C++ TPaveLabel::SetTextFont方法的具体用法?C++ TPaveLabel::SetTextFont怎么用?C++ TPaveLabel::SetTextFont使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TPaveLabel
的用法示例。
在下文中一共展示了TPaveLabel::SetTextFont方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawValueBox
void drawValueBox(double x1, double x2, double x3, int colour)
{
char optionfile[60];
std::vector<double> options;
double delta1(0.), delta2(0.), delta3(0.), delta4(0.);
double tsize(0.7);
sprintf(optionfile,"./config/drawValueBox.dat");
readData(optionfile,options);
delta1 = options[0];
delta2 = options[1];
delta3 = options[2];
delta4 = options[3];
tsize = options[4];
double xmin = x1 + delta1;
double xmax = x1 + delta2;
double ymin = x2 + delta3;
double ymax = x2 + delta4;
if ( x1 < 0 && x2 > 0) {
xmin = x1 - delta1;
xmax = x1 - delta2;
}
else if ( x1 < 0 && x2 < 0) {
xmin = x1 - delta1;
xmax = x1 - delta2;
ymin = x2 - delta3;
ymax = x2 - delta4;
}
else if ( x1 > 0 && x2 < 0) {
ymin = x2 - delta3;
ymax = x2 - delta4;
}
else if ( x1 == 0.0 ) {
xmin = xmin - delta1;
xmax = xmax ;
}
else if ( x2 == 0.0 ) {
ymin = ymin - delta3;
ymax = ymax ;
}
else {}
char label[10];
sprintf(label,"%.1f",float(x3));
TPaveLabel *box = new TPaveLabel(xmin,ymin,xmax,ymax,label);
box->SetBorderSize(0);
box->SetTextFont(42);
box->SetTextSize(tsize);
box->SetTextAlign(22);
box->SetTextColor(colour);
if (colour == 1) box->SetFillStyle(4000);
else {
box->SetFillColor(10);
box->SetTextColor(colour);
box->SetBorderSize(1);
}
box->Draw("same");
TLine * ln = new TLine(x1,x2,xmin,ymin);
ln->SetLineWidth(1);
ln->SetLineStyle(1);
ln->SetLineColor(14);
ln->Draw("same");
}
示例2: h1draw
void h1draw()
{
TString dir = gROOT->GetTutorialDir();
dir.Append("/hsimple.C");
dir.ReplaceAll("/./","/");
if (gBenchmark->GetBench("hsimple") < 0) gInterpreter->LoadMacro(dir.Data());
TFile *example = (TFile*)gROOT->ProcessLineFast("hsimple(1)");
if (!example) return;
example->ls();
TH1 *hpx = (TH1*)example->Get("hpx");
TCanvas *c1 = new TCanvas("c1","Histogram Drawing Options",200,10,700,900);
TPad *pad1 = new TPad("pad1",
"The pad with the function",0.03,0.62,0.50,0.92);
TPad *pad2 = new TPad("pad2",
"The pad with the histogram",0.51,0.62,0.98,0.92);
TPad *pad3 = new TPad("pad3",
"The pad with the histogram",0.03,0.02,0.97,0.57);
pad1->Draw();
pad2->Draw();
pad3->Draw();
// Draw a global picture title
TPaveLabel *title = new TPaveLabel(0.1,0.94,0.9,0.98,
"Drawing options for one dimensional histograms");
title->SetTextFont(52);
title->Draw();
// Draw histogram hpx in first pad with the default option.
pad1->cd();
pad1->GetFrame()->SetFillColor(18);
hpx->SetFillColor(45);
hpx->DrawCopy();
TPaveLabel *label1 = new TPaveLabel(-3.5,700,-1,800,"Default option");
label1->Draw();
// Draw hpx as a lego. Clicking on the lego area will show
// a "transparent cube" to guide you rotating the lego in real time.
pad2->cd();
hpx->DrawCopy("lego1");
TPaveLabel *label2 = new TPaveLabel(-0.72,0.74,-0.22,0.88,"option Lego1");
label2->Draw();
TPaveLabel *label2a = new TPaveLabel(-0.93,-1.08,0.25,-0.92,
"Click on lego to rotate");
label2a->Draw();
// Draw hpx with its errors and a marker.
pad3->cd();
pad3->SetGridx();
pad3->SetGridy();
hpx->SetMarkerStyle(21);
hpx->Draw("e1p");
TPaveLabel *label3 = new TPaveLabel(2,600,3.5,650,"option e1p");
label3->Draw();
// The following illustrates how to add comments using a PaveText.
// Attributes of text/lines/boxes added to a PaveText can be modified.
// The AddText function returns a pointer to the added object.
TPaveText *pave = new TPaveText(-3.78,500,-1.2,750);
TText *t1=pave->AddText("You can move");
t1->SetTextColor(4);
t1->SetTextSize(0.05);
pave->AddText("Title and Stats pads");
pave->AddText("X and Y axis");
pave->AddText("You can modify bin contents");
pave->Draw();
c1->Update();
}
示例3: MEComparePlot
void MEComparePlot(TH1 * href_, TH1 * hnew_, TString currentfile, TString referencefile, TString theDir, TString theHisto )
{
TString theName = theDir+"/"+theHisto;
std::cout << "Histogram name = " << theName << std::endl;
HistoCompare * myPV = new HistoCompare();
int rcolor = 2;
int scolor = 4;
int rmarker = 21;
int smarker = 20;
Double_t markerSize = 0.75;
href_->SetLineColor(rcolor);
href_->SetMarkerStyle(rmarker);
href_->SetMarkerSize(markerSize);
href_->SetMarkerColor(rcolor);
hnew_->SetLineColor(scolor);
hnew_->SetMarkerStyle(smarker);
hnew_->SetMarkerSize(markerSize);
hnew_->SetMarkerColor(scolor);
TCanvas *myPlot = 0;
if ( href_ && hnew_ ) {
myPlot = new TCanvas("myPlot","Histogram comparison",200,10,700,900);
TPad *pad1 = new TPad("pad1",
"The pad with the function",0.03,0.62,0.50,0.92);
TPad *pad2 = new TPad("pad2",
"The pad with the histogram",0.51,0.62,0.98,0.92);
TPad *pad3 = new TPad("pad3",
"The pad with the histogram",0.03,0.02,0.97,0.57);
pad1->Draw();
pad2->Draw();
pad3->Draw();
// Draw a global picture title
TPaveLabel *title = new TPaveLabel(0.1,0.94,0.9,0.98,theName);
title->SetFillColor(16);
title->SetTextFont(52);
title->Draw();
TText * titte = new TText();
// Draw reference
pad1->cd();
href_->DrawCopy("e1");
titte->DrawTextNDC(0.,0.02, referencefile);
// Draw new
pad2->cd();
hnew_->DrawCopy("e1");
titte->DrawTextNDC(0.,0.02, currentfile);
gStyle->SetOptStat("nemruoi");
// Draw the two overlayed
pad3->cd();
pad3->SetGridx();
pad3->SetGridy();
href_->DrawCopy("e1");
hnew_->DrawCopy("e1same");
TText* te = new TText();
te->SetTextSize(0.1);
myPV->PVCompute( href_ , hnew_ , te );
gStyle->SetOptStat(0000000);
}
TString plotFile = theHisto+".jpg";
if(myPlot) myPlot->Print(plotFile);
delete myPV;
delete myPlot;
}
示例4: h1draw
void h1draw()
{
// We attach (or generate) the ROOT file in $ROOTSYS/tutorials/hsimple.root
// or $PWD/hsimple.root
// We draw one histogram in different formats
//Author: Rene Brun
TFile *example = TFile::Open("hsimple.root");
if (!example) return;
example->ls();
TH1 *hpx = (TH1*)example->Get("hpx");
TCanvas *c1 = new TCanvas("c1","Histogram Drawing Options",200,10,700,900);
TPad *pad1 = new TPad("pad1",
"The pad with the function",0.03,0.62,0.50,0.92,21);
TPad *pad2 = new TPad("pad2",
"The pad with the histogram",0.51,0.62,0.98,0.92,21);
TPad *pad3 = new TPad("pad3",
"The pad with the histogram",0.03,0.02,0.97,0.57,21);
pad1->Draw();
pad2->Draw();
pad3->Draw();
// Draw a global picture title
TPaveLabel *title = new TPaveLabel(0.1,0.94,0.9,0.98,
"Drawing options for one dimensional histograms");
title->SetFillColor(16);
title->SetTextFont(52);
title->Draw();
// Draw histogram hpx in first pad with the default option.
pad1->cd();
pad1->GetFrame()->SetFillColor(18);
hpx->SetFillColor(45);
hpx->DrawCopy();
TPaveLabel *label1 = new TPaveLabel(-3.5,700,-1,800,"Default option");
label1->SetFillColor(42);
label1->Draw();
// Draw hpx as a lego. Clicking on the lego area will show
// a "transparent cube" to guide you rotating the lego in real time.
pad2->cd();
hpx->DrawCopy("lego1");
TPaveLabel *label2 = new TPaveLabel(-0.72,0.74,-0.22,0.88,"option Lego1");
label2->SetFillColor(42);
label2->Draw();
TPaveLabel *label2a = new TPaveLabel(-0.93,-1.08,0.25,-0.92,
"Click on lego to rotate");
label2a->SetFillColor(42);
label2a->Draw();
// Draw hpx with its errors and a marker.
pad3->cd();
pad3->SetGridx();
pad3->SetGridy();
pad3->GetFrame()->SetFillColor(18);
hpx->SetMarkerStyle(21);
hpx->Draw("e1p");
TPaveLabel *label3 = new TPaveLabel(2,600,3.5,650,"option e1p");
label3->SetFillColor(42);
label3->Draw();
// The following illustrates how to add comments using a PaveText.
// Attributes of text/lines/boxes added to a PaveText can be modified.
// The AddText function returns a pointer to the added object.
TPaveText *pave = new TPaveText(-3.78,500,-1.2,750);
pave->SetFillColor(42);
TText *t1=pave->AddText("You can move");
t1->SetTextColor(4);
t1->SetTextSize(0.05);
pave->AddText("Title and Stats pads");
pave->AddText("X and Y axis");
pave->AddText("You can modify bin contents");
pave->Draw();
c1->Update();
}