Re: setting TGraph plot options

From: Rene Brun <Rene.Brun_at_cern.ch>
Date: Wed, 15 Aug 2007 09:58:04 +0200


Hi Gero,

I forgot to mention in my previous mail that when using TBrowser one can always set a default draw option in the browser (see entry at the top right) or set this default option with something like

   TBrowser b;
   b.SetDrawOption("alp");

I also changed slightly the behaviour of TGraph::Draw. When the option "a" is specified the pad is cleared.
This is important when drawing several graphs from the browser.

Rene Brun

Gero Flucke wrote:
> On Fri, 10 Aug 2007, Rene Brun 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.
>>>
>
> Hi Rene,
> sorry for being unclear
>
>
>> Could you clarify what you mean by :same behaviour as TH1" ?
>> -same drawing options (does not make much sense)
>>
>
> No.
>
>
>> -TGraph::Draw clear the pad by default? (this would not be back compatible)
>>
>
> Probably not either ...
>
>
>> -Adding a TGraph::SetOption. This could be considered, but the idea was
>> to keep the TGraph data object as thin as possible
>>
>
> Yes, this is what I had in mind, but seeing the 'problem' of making it
> larger than necessary. So I thought that maybe fHistogram->SetOption(..)
> could be used to store the information. But that will probably not work
> always (not always fHistogram!=NULL, I guess) and probably fHistogram's
> option are also used somewhere else - or set by some user fr some special
> reason.
>
>
>> -Using option "alp" by default when clicking on a TGraph in the browser
>> (this would be OK with me)
>>
>
> This seems to be very reasonable!
>
>
>> -anything else?
>>
>
> No. If you think adding an option string to TGraph would be to 'too
> heavy', I can live with that - but I think that Peter just requested
> something like that.
>
> Cheers
>
> Gero
>
>
>> 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 Wed Aug 15 2007 - 09:58:12 CEST

This archive was generated by hypermail 2.2.0 : Wed Aug 15 2007 - 17:50:02 CEST