RE: how to draw (x,y.z) point without binning x and y ?

From: Olivier Couet <Olivier.Couet_at_cern.ch>
Date: Tue, 12 Jun 2007 15:05:50 +0200


I think you should send a little example showing what you are doing. It is difficult to understand what you are talking about ... TGraph2D is meant to handle discrete data .......  


From: lu.xianguo_at_gmail.com [mailto:lu.xianguo_at_gmail.com] On Behalf Of Xianguo Lu
Sent: Tuesday, June 12, 2007 2:59 PM
To: Olivier Couet
Cc: Olivier Couet; William Robbins; roottalk Subject: Re: [ROOT] how to draw (x,y.z) point without binning x and y ?

Thanks ! It works ~  

But what if my data are discrete?
TGraph2D are not used here.  

cheers~  

On 6/12/07, Olivier Couet <couet_at_mail.cern.ch> wrote:

        This function was in TStyle before. So try:         

TStyle::CreateGradientColorTable(Number,Stops,Red,Green,Blue,nb);                  

        On Tue, 12 Jun 2007, Olivier Couet wrote:         

>
>
> Yes, your root version is too old. CreateGradientColorTable
has been

> recently move to TColor.
> see: http://root.cern.ch/viewcvs/base/src/TColor.cxx
>
> (I do not remeber where it was before... I should search, the
CVS log in

> TColor does not tell)
>
> O.Couet
>
> On Tue, 12 Jun 2007, X. Lu, Peking Univ. wrote:
>
> > Sorry but root reports:
> >
> > Error: Function

CreateGradientColorTable(Number,Stops,Red,Green,Blue,nb) is

> > not defined in current scope FILE:test2.C LINE:22
> > Possible candidates are...
> > filename line:size busy function type and name
> > *** Interpreter error recovered ***
> >
> > why?
> >
> > test2.C is just a macro of your code:
> >
> >
> > test2()
> > {
> >
> > TCanvas *c = new TCanvas("c","Contours",600,0,600,600);
> > TF2 *f1 = new

TF2("f2","0.1+(1-(x-2)*(x-2))*(1-(y-2)*(y-2))",1,3,1,3);

> > const Int_t Number = 5;
> > Double_t Red[Number] = { 0.00, 0.09, 0.18, 0.09, 0.00 };
> > Double_t Green[Number] = { 0.01, 0.02, 0.39, 0.68, 0.97 };
> > Double_t Blue[Number] = { 0.17 , 0.39, 0.62, 0.79, 0.97 };
> > Double_t Stops[Number] = { 0.00, 0.34, 0.61, 0.84, 1.00 };
> > Int_t nb=50;
> >

TColor::CreateGradientColorTable(Number,Stops,Red,Green,Blue,nb);

> > f2->SetContour(nb);
> > f2->Draw("surf1z");
> > }
> >
> > My root version is 4.04/02g. Does it matter?
> >
> > Cheers~
> >
> >
> >
> >
> >
> > On 6/12/07, Olivier Couet <Olivier.Couet_at_cern.ch> wrote:
> > >
> > > Hope this will help:
> > >
> > >
> > > {
> > >
> > > TCanvas *c = new TCanvas("c","Contours",600,0,600,600);
> > >
> > > TF2 *f1 = new

TF2("f2","0.1+(1-(x-2)*(x-2))*(1-(y-2)*(y-2))",1,3,1,3);

> > >
> > > Int_t Number = 5;
> > >
> > > Double_t Red[Number] = { 0.00, 0.09, 0.18, 0.09, 0.00 };
> > >
> > > Double_t Green[Number] = { 0.01, 0.02 , 0.39, 0.68, 0.97
};

> > >
> > > Double_t Blue[Number] = { 0.17, 0.39, 0.62, 0.79, 0.97 };
> > >
> > > Double_t Stops[Number] = { 0.00, 0.34, 0.61, 0.84, 1.00 };
> > >
> > > Int_t nb=50;
> > >
> > >

TColor::CreateGradientColorTable(Number,Stops,Red,Green,Blue,nb);

> > >
> > > f2->SetContour(nb);
> > >
> > > f2->Draw("surf1z");
> > >
> > > }
> > > ------------------------------
> > > *From:* X. Lu, Peking Univ. [mailto:hsienkuo.lu_at_gmail.com]
> > > *Sent:* Tuesday, June 12, 2007 12:39 PM
> > > *To:* Olivier Couet
> > > *Cc:* William Robbins; roottalk
> > > *Subject:* Re: [ROOT] how to draw (x,y.z) point without
binning x and y ?

> > >
> > >
> > > Thanks ! It works.
> > >
> > > And one more question:
> > > I am using the option "Pcol". But how can I define
> > > the color myself?
> > >
> > > For example, the z value ranges from -2 to 2,
> > > then I would like to have the 4 regions
> > > -2 ~ -1, -1 ~ 0, 0 ~ 1, 1 ~ 2
> > > represented by 4 colors.
> > > How can I do this?
> > >
> > > Thanks again !
> > >
> > > Best Regards,
> > > Xianguo
> > >
> > >
> > > On 6/11/07, Olivier Couet <Olivier.Couet_at_cern.ch > wrote:
> > > >
> > > > TGraph2D with option P or P0 is the answer. See TGraph2D
help.

> > > >
> > > > -----Original Message-----
> > > > From: owner-roottalk_at_pcroot.cern.ch
> > > > [mailto:owner-roottalk_at_pcroot.cern.ch] On Behalf Of
William Robbins

> > > > Sent: Monday, June 11, 2007 5:23 PM
> > > > To: X. Lu, Peking Univ.
> > > > Cc: roottalk
> > > > Subject: Re: [ROOT] how to draw (x,y.z) point without
binning x and y ?

> > > >
> > > > Hi-
> > > > I'm having a similar problem. I know that TMarkers can
be used for a

> > > > plot of non-binned datapoints in a 2D-plane --maybe this
somehow helps

> > > > Xianguo-- but how can we extend to three dimensions?
> > > > cheers
> > > > -Billy Robbins
> > > >
> > > > On Jun 11, 2007, at 9:05 AM, X. Lu, Peking Univ. wrote:
> > > >
> > > > > Dear rooters,
> > > > >
> > > > > I want to draw a graph for a group of 3-D data (x,y,z)
in which the x

> > > > > and y values are not binned, i.e. the point in x-y
plane is exactly a

> > > > > point. And moreover, the z are binned with 5 bins and
in each bin

> > > > > the point is displayed by a specific color.
> > > > >
> > > > > How can I do that ?
> > > > >
> > > > >
> > > > > I can only think of TH2F and use SetBinContent. But
the effect is not

> > > > > so satisfactory.
> > > > >
> > > > > Thanks in advance !
> > > > >
> > > > > Best Regards,
> > > > > Xianguo
> > > > >
> > > > >
> > > > > --
> > > > > Take flight into the sky, beyond the moon, beyond my
mind.

> > > > >
> > > > > Xianguo LU
> > > > > Physics Department, Peking University
> > > > > Beijing, China
> > > > > Tel: 0086-10-62753888(o)
> > > >
> > > >
> > >
> > >
> > > --
> > > Take flight into the sky, beyond the moon, beyond my mind.

> > >
> > > Xianguo LU
> > > Physics Department, Peking University
> > > Beijing, China
> > > Tel: 0086-10-62753888(o)
> > >
> >
> >
> >
> >
>
>
        

	--
	Org:    CERN - European Laboratory for Particle Physics.
	Mail:   1211 Geneve 23 - Switzerland
Mailbox: J25910
	E-Mail: Olivier.Couet_at_cern.ch                            Phone:
+41 22 7676522
	WWW:    http://cern.ch/Olivier.Couet/                    Fax:
+41 22 7670300         
-- 
Take flight into the sky, beyond the moon, beyond my mind.

Xianguo Lu 
Physics Department, Peking University
Beijing, China 
Received on Tue Jun 12 2007 - 15:05:58 CEST

This archive was generated by hypermail 2.2.0 : Wed Jun 13 2007 - 05:50:02 CEST