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