Re: setting TGraph plot options

From: Rene Brun <Rene.Brun_at_cern.ch>
Date: Fri, 10 Aug 2007 17:04:54 +0200


Hi Gero,

Gero Flucke wrote:
>> You can change the default draw option when browsing graphs by adding
>> the following line
>> in your system.rootrc file (or .rootrc)
>>
>> TGraph.BrowseOption: alp
>>
>>
>
> Hi Rene,
> it would be really nice if TGraph would have similar behaviour as TH1 for
> things concerning drawing etc.
>

Could you clarify what you mean by :same behaviour as TH1" ?

 -same drawing options (does not make much sense)
 -TGraph::Draw clear the pad by default? (this would not be back compatible)
 -Adding a TGraph::SetOption. This could be considered, but the idea was 
to keep the
  TGraph data object as thin as possible  -Using option "alp" by default when clicking on a TGraph in the browser (this would be OK with me)
 -anything else?

Rene Brun

> For hists I can use TH1::SetOption which then can (interactively) be
> overwritten by SetDrawOption, but I (and I guess Peter) miss this feature
> for TGraph.
> Couldn't it be added? Perhaps using internally fHistogram->SetOption()
> (in case there are no 'overlaps' between graph and hist drawing options)?
>
> Gero
>
> Peter Cogan wrote:
>
>> Hi,
>>
>> the attached script makes a simple TGraph from a TF1 and saves it to a
>> root file. If I open the resulting file in a TBrowser and
>> double-click on the graph, I get a plot but no axes etc. I know that I
>> could set my plot options from the command line with
>> f1->Draw("AP*"), but is it possible to set draw options from my script
>> so that someone else who recieves the file can just double
>> click on the graph and see the options I want (eg axes, markers etc).
>> I've trawled the online documentation and header files and
>> can't find it.
>>
>> thanks for your help
>> Peter
>>
>> rootver 5.16/00 Max OSX 10.4.10
>>
>> {
>> gr = new TGraph(new TF1("f1", "sin(x)", 0, 1));
>> TFile f("out.root", "recreate");
>> gr->Write();
>> f.Close();
>> }
>>
>
>
>
Received on Fri Aug 10 2007 - 17:05:00 CEST

This archive was generated by hypermail 2.2.0 : Fri Aug 10 2007 - 23:50:02 CEST