Re: setting TGraph plot options

From: Gero Flucke <flucke_at_mail.cern.ch>
Date: Tue, 14 Aug 2007 18:14:59 +0200 (CEST)

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();
> > }

-- 
-----------------------------------------------------------------------
Gero Flucke                   office: DESY, Bldg. 67b, room 24
Inst. f. Experimentalphysik           fon: +49 (0)40 8998 4743
Universitaet Hamburg                  fax: +49 (0)40 8998 2959
Luruper Chaussee 149         at CERN: Bldg. 32 office 3-B20 
22761 Hamburg                         fon: +41 (0)22 76-77557
Germany

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Received on Tue Aug 14 2007 - 18:15:15 CEST

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