RE: TGraph drawing options

From: Anton Fokin (fokin@tsl.uu.se)
Date: Fri Mar 03 2000 - 11:08:14 MET


Hi Rene,

this is not exactly a solution I want to have. A set of markers is not a
graph, isn't it? Apart from not be able to handle it as a single object
(i.e. read, write, send, change attributes for each point at once), you have
some problems with drawing, for example with clipping (on zoom you get
points painted outside the histogram).

Best,
Anton

-----Original Message-----
From: Rene Brun [mailto:brun@pcbrun.cern.ch]
Sent: Thursday, March 02, 2000 11:06 PM
To: Anton Fokin
Cc: Rene Brun; roottalk@pcroot.cern.ch
Subject: Re: TGraph drawing options


Hi Anton,
What you want is already implemented. I show two methods
in the example below> I hope it is clear enough.

Rene Brun

{
   gROOT->Reset();
   gStyle->SetPalette(1);
   gStyle->SetOptStat(0);
   c1 = new TCanvas("c1");
   c1->SetGrid();

   const Int_t n = 20;
   TH1F *hgr = new TH1F("hgr","a simple graph",n,0.5,n+0.5);
   for (Int_t i=1;i<=n;i++) hgr->SetBinContent(i,10*sin(0.1*i));
   hgr->SetMarkerStyle(21);
   hgr->SetXTitle("X title");
   hgr->SetYTitle("Y title");
   hgr->Draw("p");
   for (Int_t j=1;j<=n;j++) {
      TMarker *m = new TMarker(hgr->GetBinCenter(j),
                           0.5*hgr->GetBinContent(j),22);
      m->SetMarkerColor(j);
      m->Draw();
   }
}


On Thu, 2 Mar 2000, Anton Fokin wrote:

> Hi rooters!
>
> I think it would be nice to have a mode in which point number is drawn as
a
> marker for TGraph. It is very useful if you want to plot, for example,
> points from an event generator running with different sets of initial
> conditions, i.e. 1,2,3,4,5 and you want to see a correspondence between
set
> number and a point on the graph.
>
> It would be nice of course to have an opportunity to set different
> colors/attributes for every graph point, but it is not easy to implement.
> Well, it is easy if Rene adds a "fZ" array with point colors and then
> changes a bit Paint function :)
>
> Best regards,
> Anton
>



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:20 MET