Chris Green wrote: > > Hi, > > Can anyone tell me why, in the attached source, I can't set the position > of the title pave? It appears to set the fill style, but the position > commands are ignored. > > Thanks, > > Chris. > > --- > Chris Green. HEP, University of Liverpool > MAIL Chris.Green@cern.ch, WWW http://hep.ph.liv.ac.uk/~chris/ > +41 22 767 8075. On LTA at CERN. > --- > I DON'T CARE WHAT IT SAYS, said the tall biker in the helmet, I NEVER LAID A FINGER ON HIM. -- (Terry Pratchett & Neil Gaiman, Good Omens) > > --------------------------------------------------------------- > > { > TFile hfile("exchists.root"); > TCanvas *c1 = new TCanvas("c1", "c1",19,73,696,963); > c1->SetHighLightColor(2); > c1->Range(3.39546,6.83951,99.7426,99.8181); > c1->SetFillColor(10); > c1->SetBorderSize(2); > c1->SetLeftMargin(0.167151); > c1->SetBottomMargin(0.136166); > c1->GetFrame()->SetFillStyle(0); > > TLine *mselmax = new TLine(86.,19.5.,86.,86.); > TLine *kine = new TLine(19.5,19.5,90.5,90.5); > > hexcomb->SetXTitle("M(e&^@\176!) (GeV)"); > hexcomb->SetYTitle("M(`h#&^@\1760?1!) (GeV)"); > hexcomb->SetTitleOffset(1.3,"X"); > hexcomb->SetTitleOffset(1.3,"Y"); > hexcomb->SetFillColor(3); > hexcomb->Draw("box"); > c1->Update(); > TPaveText *title = (TPaveText*)c1->GetPrimitive("title"); > title->SetFillStyle(0); > title->GetLine(0)->SetTextFont((Font_t) 22); > title->GetLine(0)->SetTextFont((Font_t) 22); > title->SetX1(22.0); > title->SetX2(88.0); > title->SetY1(92.0); > title->SetY2(96.0); > c1->Modified(); > c1->Update(); > mselmax->Draw(); > kine->Draw(); > c1->Modified(); > c1->cd(); > > Float_t mslim_x[4] = {86.,90.5,90.5,86.}; > Float_t mslim_y[4] = {19.5,19.5,90.5,86.}; > > mslim = new TGraph (4,mslim_x,mslim_y); > mslim->SetFillStyle(3002); > mslim->SetFillColor(2); > mslim->Draw("F"); > > Float_t mclim_x[4] = {19.5,90.5,86.0,19.5}; > Float_t mclim_y[4] = {19.5,90.5,90.5,24.0}; > > mclim = new TGraph (4,mclim_x,mclim_y); > mclim->SetFillStyle(3002); > mclim->SetFillColor(2); > mclim->Draw("F"); > > } In ROOT, objects derived prom TPave (TPavelavel, TPaveText,etc.) have a special behaviour. Histogram titles and stats are TPaveText objects. We want to give the possibility to move these objects anywhere in the canvas or pad. This move must be independent from the pad coordinate systems, log or linear scale. The real coordinate system for these objects is the NDC (Normalized Device Coordinate) system with a range [0,1]. To specify a change of coordinate, you should call the set of routines SetX1NDC, SetY1NDC, etc (same for GetFunctions). These functions are part of the TPave base class. So, in your example, simply replace SetX1 by SetX1NDC with a parameter in the range [0,1]. Thanks for pointing this issue that should be described somewhere in the drawing package. Rene Brun
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:26:18 MET