Thanks Rene, it works, but you may recognize that the solution is not so
elegant.
I was looking also for something like:
Int_t colors[1];
colors[0] = 2; //red
gStyle->SetPalette(1,colors);
TCanvas* c1 = new TCanvas("c1","Contour",100,100,600,600);
h1->SetContour(1); h1->SetContourLevel(0,4.605); //Chi2 for 2 dof and 90% CL h1->Draw("CONT1"); c1->Update();
TPad *overlay = new TPad("overlay","",0,0,1,1);
overlay->SetFillStyle(4000);
overlay->Draw();
Double_t x1,y1,x2,y2;
c1->GetRange(x1,y1,x2,y2);
overlay->Range(x1,y1,x2,y2);
colors[0] = 4; //blue
gStyle->SetPalette(1,colors);
h2->SetFillStyle(4000); h2->SetContour(1); h2->SetContourLevel(0,4.605);
overlay->cd();
h2->Draw("CONT1");
overlay->Update();
But It shows only the second h2 contour as if it was opaque contrary to the SetFillStyle(4000) order!...
May be you can comment.
Regards
Jean-Eric
--On samedi 7 mai 2005 23:24 +0200 Rene Brun <brun_at_pcroot.cern.ch> wrote:
> Jean-Eric,
>
> What about the following; (assuming TH2 *h1, *h2)
>
> int colors[2] = {2,4}; //red, blue
> gStyle->SetPalette(2,colors);
> h1->SetContour(2);
> h1->SetContourLevel(0,level1); //value for your first level
> h1->SetContourLevel(1,1e6); //non-existing high level
> h1->Draw("cont1");
> h2->SetContour(2);
> h2->SetContourLevel(0,0); //non existing low level
> h2->SetContourLevel(1,level2); //value for your second level
> h2->Draw("cont1 same");
>
> Rene Brun
>
>
>
> On Sat, 7
> May
> 2005,
> Jean-Eric Campagne wrote:
>
>> Dear developpers,
>>
>> . I have 2 TH2Ds
>> . for each one I make a Draw("CONT1") after setting the number of
>> contours to 1 level
>> . I would like to superpose the two results with a different color for
>> each histogram with its 1-contour level.
>>
>> For the moment I do not manage. I have succeeded to superpose the two
>> contours but they share the same palette so they have the same color!!!
>>
>> Can you help me, I have already spend 1/2 day for this stupid thing?
>> I wander if PAW do not manage better...
>>
>> Regards
>> Jean-Eric
>> ........................................................................
>> ... .LAL - IN2P3 - CNRS
>> .LAL - B.P 34 - 91898 Orsay Cedex - France
>> .Piece 108
>> .Tel +33 (0)1 64 46 84 29
>> .Fax +33 (0)1 64 46 83 97
>> ........................................................................
>> ...
>>
>>
>
........................................................................... .LAL - IN2P3 - CNRS .LAL - B.P 34 - 91898 Orsay Cedex - France .Piece 108 .Tel +33 (0)1 64 46 84 29
...........................................................................Received on Sun May 08 2005 - 09:54:23 MEST
This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:07 MET