当前位置: 首页>>代码示例>>C++>>正文


C++ TGaxis::ChangeLabel方法代码示例

本文整理汇总了C++中TGaxis::ChangeLabel方法的典型用法代码示例。如果您正苦于以下问题:C++ TGaxis::ChangeLabel方法的具体用法?C++ TGaxis::ChangeLabel怎么用?C++ TGaxis::ChangeLabel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TGaxis的用法示例。


在下文中一共展示了TGaxis::ChangeLabel方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: xyplot

void xyplot()
{
   TCanvas *c = new TCanvas("c","XY plot",200,10,700,500);

   // Remove the frame
   c->SetFillColor(kWhite);
   c->SetFrameLineColor(kWhite);
   c->SetFrameBorderMode(0);

   // Define and draw a curve the frame
   const Int_t n = 4;
   Double_t x[n] = {-1, -3, -9, 3};
   Double_t y[n] = {-1000,  900,  300, 300};
   gr = new TGraph(n,x,y);
   gr->SetTitle("XY plot");
   gr->SetMinimum(-1080);
   gr->SetMaximum(1080);
   gr->SetLineColor(kRed);
   gr->Draw("AC*");

   // Remove the frame's axis
   gr->GetHistogram()->GetYaxis()->SetTickLength(0);
   gr->GetHistogram()->GetXaxis()->SetTickLength(0);
   gr->GetHistogram()->GetYaxis()->SetLabelSize(0);
   gr->GetHistogram()->GetXaxis()->SetLabelSize(0);
   gr->GetHistogram()->GetXaxis()->SetAxisColor(0);
   gr->GetHistogram()->GetYaxis()->SetAxisColor(0);

   gPad->Update();

   // Draw orthogonal axis system centered at (0,0).
   // Draw the Y axis. Note the 4th label is erased with SetLabelAttributes
   TGaxis *yaxis = new TGaxis(0, gPad->GetUymin(),
                              0, gPad->GetUymax(),
                              gPad->GetUymin(),gPad->GetUymax(),6,"+LN");
   yaxis->ChangeLabel(4,-1,0.);
   yaxis->Draw();

   // Draw the Y-axis title.
   TLatex *ytitle = new TLatex(-0.5,gPad->GetUymax(),"Y axis");
   ytitle->Draw();
   ytitle->SetTextSize(0.03);
   ytitle->SetTextAngle(90.);
   ytitle->SetTextAlign(31);

   // Draw the X axis
   TGaxis *xaxis = new TGaxis(gPad->GetUxmin(), 0,
                              gPad->GetUxmax(), 0,
                              gPad->GetUxmin(),gPad->GetUxmax(),510,"+L");
   xaxis->Draw();

   // Draw the X axis title.
   TLatex *xtitle = new TLatex(gPad->GetUxmax(),-200.,"X axis");
   xtitle->Draw();
   xtitle->SetTextAlign(31);
   xtitle->SetTextSize(0.03);
}
开发者ID:Y--,项目名称:root,代码行数:57,代码来源:xyplot.C


注:本文中的TGaxis::ChangeLabel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。