[ROOT] Re: [root] Fill with oblique lines

From: Rene Brun (Rene.Brun@cern.ch)
Date: Fri Feb 23 2001 - 15:28:27 MET


Hi MinJung,
I looked at your histogram file. Your 3 histograms have 1000x1000 bins,
but you fill in average only one bin out of 10 in the areas that you
would like to shade with oblique lines. In this case the contour algorithm
cannot work.

You will find in attachment a script showing an alternative.
I have used the graphics editor to select the area to be shaded and created
3 TCutG objects.

Rene Brun

Min Jung Kweon wrote:
> 
>  Hi all,
> 
>  I made a two dimensional histogram with markers like circle, square and
> triangle.
> 
>  Here is a part of my code.
> 
> ============================================>
> 
>   Pion_of_Nucleon = new TH2D("ratio1","Mub vs
> T",1000,0.1,2.1,1000,0.02,0.22);
>   Kaonpl_of_Pion = new TH2D("ratio2",Mub vs
> T",1000,0.1,2.1,1000,0.02,0.22);
>   Lamda_of_Nucleon = new TH2D("ratio3",Mub vs
> T",1000,0.1,2.1,1000,0.02,0.22);A
> 
>   ................
> 
>         if ( (rate1 >= rangeleft*1.05) & (rate1 <= rangeright*1.05) )
> Pion_of_Nucleon -> Fill(Mub,T);
>         if ( (rate2 >= rangeleft*0.19) & (rate2 <= rangeright*0.19) )
> Kaonpl_of_Pion -> Fill(Mub,T);
>         if ( (rate3 >= rangeleft*0.080) & (rate3 <= rangeright*0.080) )
> Lamda_of_Nucleon -> Fill(Mub,T);
> 
>   ................
> 
>   c1->cd();
>   Pion_of_Nucleon->SetMarkerColor(2);
>   Pion_of_Nucleon->SetMarkerSize(0.2);
>   Pion_of_Nucleon->SetMarkerStyle(3);
>   Pion_of_Nucleon->Draw();
> 
>   Kaonpl_of_Pion->SetMarkerColor(3);
>   Kaonpl_of_Pion->SetMarkerSize(0.2);
>   Kaonpl_of_Pion->SetMarkerStyle(27);
>   Kaonpl_of_Pion->Draw("SAME");
> 
>   Lamda_of_Nucleon->SetMarkerColor(4);
>   Lamda_of_Nucleon->SetMarkerSize(0.2);
>   Lamda_of_Nucleon->SetMarkerStyle(22);
>   Lamda_of_Nucleon->Draw("SAME");
> 
> <======================================
> 
>  However, instead of these kind of markers I would like to fill the area
> with oblique lines.
> 
>  To help you understand my question, I attach two figure files. One is
> what I made with markers and the other is like what I want to make.
> 
>  Thank you
> 
>  Regards,
>  MinJung
> 
>   --------------------------------------------------------------------------------
> 
>                       Name: obliques.jpg
>    obliques.jpg       Type: JPEG Image (IMAGE/JPEG)
>                   Encoding: BASE64
> 
>                      Name: markers.jpg
>    markers.jpg       Type: JPEG Image (IMAGE/JPEG)
>                  Encoding: BASE64

{
   gROOT->Reset();
   TCanvas *c1 = new TCanvas("c1");
   c1->DrawFrame(0.1,0.02,2.1,0.22);
   TCutG *pioncut = new TCutG("pioncut",11);
   pioncut->SetVarX("");
   pioncut->SetVarY("");
   pioncut->SetPoint(0,0.482184,0.210572);
   pioncut->SetPoint(1,0.471408,0.201568);
   pioncut->SetPoint(2,0.471408,0.11947);
   pioncut->SetPoint(3,0.482184,0.10464);
   pioncut->SetPoint(4,0.643822,0.0379025);
   pioncut->SetPoint(5,0.690517,0.0288983);
   pioncut->SetPoint(6,0.525287,0.109407);
   pioncut->SetPoint(7,0.528879,0.16661);
   pioncut->SetPoint(8,0.568391,0.199979);
   pioncut->SetPoint(9,0.561207,0.211102);
   pioncut->SetPoint(10,0.482184,0.210572);
   pioncut->SetFillColor(2);
   pioncut->SetFillStyle(3004);
   pioncut->Draw("f");
   
   TCutG *kaoncut = new TCutG("kaoncut",16);
   kaoncut->SetVarX("");
   kaoncut->SetVarY("");
   kaoncut->SetPoint(0,0.105029,0.101992);
   kaoncut->SetPoint(1,0.105029,0.0951059);
   kaoncut->SetPoint(2,0.356466,0.0945763);
   kaoncut->SetPoint(3,0.45704,0.0972246);
   kaoncut->SetPoint(4,0.543247,0.106229);
   kaoncut->SetPoint(5,0.571983,0.121589);
   kaoncut->SetPoint(6,0.582759,0.145424);
   kaoncut->SetPoint(7,0.607902,0.208983);
   kaoncut->SetPoint(8,0.532471,0.210042);
   kaoncut->SetPoint(9,0.51092,0.136419);
   kaoncut->SetPoint(10,0.496552,0.116822);
   kaoncut->SetPoint(11,0.449856,0.108877);
   kaoncut->SetPoint(12,0.360057,0.103051);
   kaoncut->SetPoint(13,0.259483,0.101462);
   kaoncut->SetPoint(14,0.130172,0.101992);
   kaoncut->SetPoint(15,0.105029,0.101992);
   kaoncut->SetFillColor(3);
   kaoncut->SetFillStyle(3010);
   kaoncut->Draw("f");
   
   TCutG *lamdacut = new TCutG("lamda",20);
   lamdacut->SetPoint(0,0.105029,0.108347);
   lamdacut->SetPoint(1,0.557615,0.107818);
   lamdacut->SetPoint(2,0.708477,0.106229);
   lamdacut->SetPoint(3,0.895259,0.103051);
   lamdacut->SetPoint(4,1.00661,0.0945763);
   lamdacut->SetPoint(5,1.09282,0.0834534);
   lamdacut->SetPoint(6,1.13951,0.0707415);
   lamdacut->SetPoint(7,1.18621,0.055911);
   lamdacut->SetPoint(8,1.20417,0.0421398);
   lamdacut->SetPoint(9,1.21135,0.0288983);
   lamdacut->SetPoint(10,1.20057,0.0198941);
   lamdacut->SetPoint(11,1.19339,0.0283686);
   lamdacut->SetPoint(12,1.16825,0.0522034);
   lamdacut->SetPoint(13,1.11078,0.0670339);
   lamdacut->SetPoint(14,1.03894,0.0823941);
   lamdacut->SetPoint(15,0.909626,0.0908686);
   lamdacut->SetPoint(16,0.755172,0.0956356);
   lamdacut->SetPoint(17,0.586351,0.0972246);
   lamdacut->SetPoint(18,0.101437,0.0982839);
   lamdacut->SetPoint(19,0.105029,0.108347);
   lamdacut->SetFillColor(4);
   lamdacut->SetFillStyle(3013);
   lamdacut->Draw("f");

}
   



This archive was generated by hypermail 2b29 : Fri Jun 08 2001 - 11:51:14 MEST