Chris Green wrote: > > How can I get access to the TPaveText title for a histogram from inside a > macro? title->SetFillStyle(0), etc, works from the interpreter line, but > not when wrapped in {}. I've tried FindObject, but I'm obviously missing > something about this scope lark. > The TPaveText title object is created when the histogram is "painted". It does not exist yet immediatly after teh call to h->Draw(). To force the "paint" operation in a macro, you must update the pad/canvas. See an example of macro below and also look at: http://root.cern.ch/root/HowtoDraw.html { gROOT->Reset(); TFile f("hsimple.root"); hpx->Draw(); c1->Update(); TPaveText *title = (TPaveText*)c1->GetPrimitive("title"); title->SetFillColor(21); c1->Modified(); } > Also the `save as .C' option is a bit haphazard about which attributes > are saved (eg histogram title attributes, axis titles aren't). Is there > some rule about which attributes are saved and which aren't? > Currently only the AttFill, AttLine and AttMarker attributes are saved. Histogram contents and other parameters are not saved. I have assumed that the histogram is already available in a file. I will also save all axis attributes in the coming version. I also would like to provide an option to save the full histogram definition, contents, errors, etc. > Finally, what's the easiest way of shading in an area on a histogram > in a specific colour / shading pattern? > Click on the histogram with the rigth mouse button and select the item "SetFillAttributes". This will display a panel with colors, fill styles,etc. In a macro, you can do: h->SetFillColor(color); h->SetFillStyle(3001); Rene Brun
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:26:18 MET