ROOT中图形格式操作的使用_第1页
ROOT中图形格式操作的使用_第2页
ROOT中图形格式操作的使用_第3页
ROOT中图形格式操作的使用_第4页
ROOT中图形格式操作的使用_第5页
已阅读5页,还剩71页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

ROOT中图形格式

操作的使用北京大学物理系李新ROOT的图形控制ROOT的图形控制主要通过ROOT中TStyle类的参数控制来实现ROOT启动后自动建立gStyle()的全局指针来控制画形我的方法:通过定义TStyle的指针MyStyle实现图形参数控制TStyle*MyStyle=newTStyle(“style”,”MyStyle”)

……

MyStyle.cd();使用方法在所写的宏中或程序中加入#include“MyStyle.h”在所写的宏或程序中调用函数

SetMyStyle();说明在本幻灯片中所有用绿色标定的函数中的函数参数值均为默认值TStyle中成员函数的分类和作用说明1.关于Canvas的格式操作2.关于Title的格式操作3.关于Axis的格式操作4.关于Pad的格式操作5.关于Frame的格式操作6.关于Histogram的格式操作7.关于StatBox的格式操作8.一些附加选项操作一些ROOT作图中的常用属性问题ColorFontStyleLineStyle关于Canvas的操作(1)SetCanvasBorderMode(Int_tmode=1)SetCanvasBorderSize

(Width_tsize=1)SetCanvasColor(Color_tcolor=19)InRoot,BorderModecanbeselected(1,0,-1)Asimpleexamplesin(x)/xSetCanvasBorderMode(-1);SetCanvasBorderSize(5);SetCanvasColor(33);关于Title的操作(1)SetTitleH(Float_th=0)SetTitleW(Float_tw=0)SetTitleX(Float_tx=0)SetTitleY(Float_ty=1)SetTitleX&YrepresenttheX&YvalueoftheleftdowncorneroftheTitle,H&Wrepresenttheheightandwidth.TheparameterareallinNDCform;whichrepresenttherelativeratioofthecavasSetTitleH(h=0.05);SetTitleW(w=0.15);SetTitleX(x=0.42);SetTitleY(y=0.95);关于Title的操作(2)SetTitleFont(Style_tfont=62)SetTitleTextColor(Int_tcolor=1)SetTitleBorderSize(Width_tsize=2)SetTitleColor(Int_tcolor=19)TitleBorderSizeisreferredasdarkborderofthemaintitle,TitleColorascolorofthemaintitleboxSetTitleFont(31)NoticethattitlefontappliedtobothCanvasTitleandaxistitleSetTitleTextColor(4);Again,thetextcolorweselectedappliedtoalltitles.SetTitleBorderSize(5)SetTitleColor(17)关于Axis的操作(1)SetTitleXSize(Float_tsize=0.04)SetTitleOffset(Float_toffset=1,Option_t*axis=X)Currently,Idonnotknowexacltythewhatoffsetvaluemeans.SoIwillimplementitlaterSetTitleXSize(0.03)similarlywecanuse:SetTitleYSize(0.03)WecanseethatXtitleoverlapswiththeLabel,thereforeweuseSetTitleOffset(1.5,”X”);关于Axis的操作(2)SetLabelColor(Color_tcolor=1,Option_t*axis=X)SetLabelFont(Style_tfont=62,Option_t*axis=X)SetLabelOffset(Float_toffset=0.005,Option_t*axis=X)SetLabelSize(Float_tsize=0.04,Option_t*axis=X)SetLabelColor(4,”Y”);SetLabelColor(4,”X”);SetLabelOffset(0.003,”X”)SetLabelOffset(0.003,”Y”)SetLabelSize(0.03,“X”)SetLabelSize(0.03,“Y”)关于Axis的操作(3)SetAxisColor(Color_tcolor=1,Option_t*axis=X)SetTickLength(Float_tlength=0.03,Option_t*axis=X)SetNdivisions(Int_tn=510,Option_t*axis=X)ParametersinSetNDivsisions(n=N1+100*N2+10000*N3N1=numberofprimarydivisions.N2=numberofsecondarydivisions.N3=numberof3rddivisions.)SetAxisColor(4,”X”)SetAxisColor(4,”Y”)SetTickLength(0.01,”X”)SetTickLength(0.01,”Y”)SetNdivisions(1010,X)Itisusefultodothiswhenyouneedtofindlocatesomepointonthegraph关于PAD的操作SetPadTopMargin(Float_tmargin=0.1)SetPadBottomMargin(Float_tmargin=0.1)SetPadLeftMargin(Float_tmargin=0.1)SetPadRightMargin(Float_tmargin=0.1)(Ps:WhenthereisnoPaddefinedintheCanvas,theCanvasitselfthusbeconsideredasaPad)Forexample,whenweneedtohavemarginononesideofthecanvasforotherpurpose,say,leftside.ThenwecanletSetPadLeftMargin(0.3)关于Frame的操作SetFrameBorderMode(Int_tmode=1)SetFrameBorderSize(Width_tsize=1)SetFrameFillColor(Color_tcolor=1)SetFrameLineColor(Color_tcolor=1)SetFrameLineStyle(Style_t

styl=0)SetFrameLineWidth(Width_twidth=1)SetFrameFillColor(33)WeadoptthesamecolorasCanvasSetFrameLineColor(4)SetFrameLineStyle(1)SetFrameLineWidth(1)SetFrameBorderMode(-1)SetFrameBorderSize(3)Itisalmostdonenow!!!SetFuncColor(4)SetPadGridX(1)SetPadGridY(1)Here,itspossibletoadjustGridStyle(as

LineStyle)Also,itspossibletosetfunctionlinecolorandwidthFurtherDetailedinformationcanbefoundinMyStyle.hWell,thePictureisnowdifferentinStyle.Letusseeanotherpicture.HeretheMethodisaddedandthepicturehasthestyleIsetbefore.关于Histogram的操作SetHistFillColor(Color_tcolor=1)SetHistLineColor(Color_tcolor=1)SetHistLineStyle(Style_t

styl

=0)SetHistLineWidth(Width_twidth=1)HereLineandFillattributesarethesameasFrameLineattributes.SetHistFillColor(38)关于StatBox的操作(1)SetOptStat(mode)Theparametermodecanbe=iourmen(default=0001111)n=1;nameofhistogramisprintede=1;numberofentriesprintedm=1;meanvalueprintedr=1;rmsprintedu=1;numberofunderflowsprintedo=1;numberofoverflowsprintedi=1;integralofbinsprintedSetOptStat(1111111)关于StatBox的操作(2)SetStatX(Float_tx=0)SetStatY(Float_ty=0)SetStatW(Float_tw=0.19)SetStatH(Float_ty=0.1)TheXYWHaresameasTitle关于StatBox的操作(3)

SetStatBorderSize(Width_tsize=2)

SetStatColor(Int_tcolor=19)

SetStatFont(Style_tfont=62)

SetStatFontSize(Float_tsize=0)

SetStatFormat(const

char*format=6.4g)InFormat6representsthemargin,0.4representsFontSizeCurrentlythereisstillbugsinRoot,sotheonlywaytoutilizeitistoprint

gStyle->*inyourprogramme附加选项操作(1)SetOptLogx(Int_t

logx

=0)SetOptLogy(Int_tlogy=0)SetOptLogz(Int_t

logz

=0)SetOptTitle(Int_ttit=1)HereWhenyouSelect1,itmeanstrue.SetOptX(1)SetOptTitle(0)Thennoticethechangeofthepicture附加选项操作(2)SetOptDate(Int_tmode)mode=1(default)dateisprintedinthebottom/leftcorner.mode=2dateisprintedinthebottom/rightcorner.mode=3dateisprintedinthetop/rightcorner.SetOptDate(1)附加选项操作(2)Thedatepositioncanalsobecontrolledby:gStyle->SetDateX(x);xinNDCgStyle->SetDateY(y);yinNDCThedatetextattributescanbechangedwith:gStyle->GetAttDate()->SetTextFont(font=62);gStyle->GetAttDate()->SetTextSize(size=0.025);gStyle->GetAttDate()->SetTextColor(color=1);

HavinganyproblemsorsuggestionsContactme:

lixin@

ThankyouColorisselectedfrom1-50,thecolorcanbeselectedwithitsnumberinrootfromleftdowncornertorightupcorner.font:Textfontcode=10*fontnumber+precisionFontnumbersmustbebetween1and14precision=1fasthardwarefonts(stepsinthesize)precision=2scalableandrotatablehardwarefontsThedefaultfontnumberis62.Fontsize:0-0.15(0.15isthebiggestusually)FontAlign:9possiblecandidates…FontIDX11Win32TTFlfItalic

lfWeightx101:times-medium-i-normal"TimesNewRoman"142:times-bold-r-normal"TimesNewRoman"073:times-bold-i-normal"TimesNewRoman“174:helvetica-medium-r-normal"Arial"045:hel

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论