RE: [ROOT] TF2::Draw() question

From: Olivier Couet (Olivier.Couet@cern.ch)
Date: Thu Jul 24 2003 - 17:22:41 MEST


Ed,

 Yes, I see what you mean. That kind of artifact may appear when a level is 
not entirely visible on screen. The fill area is not well completed and 
it may looks weird. You can also try "cont4" and redefine a transparent 
pad on top of it in order to be able to superimpose something on it. I 
attached a copy of an answer I did sometimes ago regarding the same topic.

You can also use COL instead of CONT0.

Cheers,         Olivier


=============================================================
 As I told you in my last email, the CONT4 option draws the contours using
the surface's algorithm. This algorithm changes the Pad coordinates (it  
has its own "normalized" space). In principal that is not a problem except
when you want to superimpose something on it, as you do in your example.
To bypass this problem, the simplest way is to create a transparent Pad on
top of it with the coordinates you need, and draw the superimposed
graphics in that pad.. The Following little example shows how to proceed:

{
   gROOT->Reset();
   TCanvas *c1 = new TCanvas("c1","2 dimensional fit results",500,500);
   TPad    *z1 = new TPad("z1","z1", 0.1, 0.1, 0.9, 0.9); z1->Draw();
   TPad    *z2 = new TPad("z2","z2", 0.1, 0.1, 0.9, 0.9); z2->Draw();
   z2->SetFillStyle(4000); // z2 in transparent

   TFile* f1 = new TFile("hvqfits_cteq6_2D_hf255.root","READ");
   TF2*  chi2fit   = (TF2*)(f1->Get("Chi2Fit_charm_mass_and_epsilon2"));
   TGraph* minimum = (TGraph*)(f1->Get("BestFit_charm_mass_and_epsilon2"));
   TGraph* onesigm = (TGraph*)(f1->Get("onesig_c_and_e"));
   minimum->SetMarkerStyle(20);
   minimum->SetMarkerColor(2);

   z1->cd();
   chi2fit->Draw("cont4 z");

   z2->cd();
   z2->Range(0.851562,-0.000616667,2.09844,0.0115167);
   minimum->Draw("p");
   onesigm->Draw("p");
}
=======================================================

-- 
Org:    CERN - European Laboratory for Particle Physics.
Mail:   1211 Geneve 23 - Switzerland                     Mailbox: J25910      
E-Mail: Olivier.Couet@cern.ch                            Phone:   +41 22 7676522
WWW:    http://cern.ch/Olivier.Couet/                    Fax:     +41 22 7677155



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:13 MET