本文整理汇总了C++中TGraph::SetHighlight方法的典型用法代码示例。如果您正苦于以下问题:C++ TGraph::SetHighlight方法的具体用法?C++ TGraph::SetHighlight怎么用?C++ TGraph::SetHighlight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TGraph
的用法示例。
在下文中一共展示了TGraph::SetHighlight方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: test5
void test5()
{
TCanvas *c1 = new TCanvas("c1", "c1", 0, 0, 600, 300);
TCanvas *c2 = new TCanvas("c2", "c2", 605, 0, 600, 300);
const Int_t n = 20;
Double_t x[n], y[n];
for (Int_t i = 0; i < n; i++) {
x[i] = i;
y[i] = i;
}
TGraph *gr = new TGraph(n, x, y);
gr->SetMarkerStyle(20);
c1->cd();
c1->SetGrid();
gr->Draw("APC");
gr->SetHighlight();
TGraph::SetHighlightPad(c2);
TH1F *h[n];
for (Int_t i = 0; i < n; i++) {
h[i] = new TH1F(TString::Format("h_%02d", i), "", 100, -5.0, 5.0);
h[i]->SetTitle(h[i]->GetName());
h[i]->FillRandom("gaus");
gr->AddHighlight(i, h[i]);
}
gr->GetListOfHighlights()->SetOwner(kTRUE);
gr->RemovePoint(5);
gr->RemovePoint(9); // point with x = 10 (after remove previous point)
delete h[14];
delete h[17];
}
示例2: highlight1
void highlight1()
{
TCanvas *ch = new TCanvas("ch", "ch", 0, 0, 700, 500);
const Int_t n = 500;
Double_t x[n], y[n];
TH1F *h[n];
for (Int_t i = 0; i < n; i++) {
h[i] = new TH1F(TString::Format("h_%02d", i), "", 100, -3.0, 3.0);
// in practice gaus need reset parameters
h[i]->FillRandom("gaus", 1000);
h[i]->Fit("gaus", "Q");
h[i]->SetMaximum(250); // for n > 200
x[i] = i;
y[i] = h[i]->GetFunction("gaus")->GetParameter(2);
}
TGraph *g = new TGraph(n, x, y);
g->SetMarkerStyle(6);
for (Int_t i = 0; i < n; i++) g->AddHighlight(i, h[i]);
g->Draw("AP");
g->SetHighlight();
TPad *ph = new TPad("ph", "ph", 0.3, 0.4, 1.0, 1.0);
ph->SetFillColor(kBlue - 10);
ph->Draw();
ph->cd();
TText *info = new TText(0.5, 0.5, "please move the mouse over the graph");
info->SetTextAlign(22);
info->Draw();
ch->cd();
TGraph::SetHighlightPad(ph);
}