Re: TGraph drawing options

From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu Mar 02 2000 - 23:06:22 MET


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