surfaces.C

Go to the documentation of this file.
00001 void surfaces() {
00002    //Draw 2-Dim functions
00003    // To see the output of this macro, click begin_html <a href="gif/surfaces.gif">here</a> end_html
00004    //Author: Rene Brun
00005    
00006    TCanvas *c1 = new TCanvas("c1","Surfaces Drawing Options",200,10,700,900);
00007    c1->SetFillColor(42);
00008    gStyle->SetFrameFillColor(42);
00009    title = new TPaveText(.2,0.96,.8,.995);
00010    title->SetFillColor(33);
00011    title->AddText("Examples of Surface options");
00012    title->Draw();
00013 
00014    pad1 = new TPad("pad1","Gouraud shading",0.03,0.50,0.98,0.95,21);
00015    pad2 = new TPad("pad2","Color mesh",0.03,0.02,0.98,0.48,21);
00016    pad1->Draw();
00017    pad2->Draw();
00018    //
00019    // We generate a 2-D function
00020    TF2 *f2 = new TF2("f2","x**2 + y**2 - x**3 -8*x*y**4",-1,1.2,-1.5,1.5);
00021    f2->SetContour(48);
00022    f2->SetFillColor(45);
00023 
00024    // Draw this function in pad1 with Gouraud shading option
00025    pad1->cd();
00026    pad1->SetPhi(-80);
00027    pad1->SetLogz();
00028    f2->Draw("surf4");
00029 
00030    // Draw this function in pad2 with color mesh option
00031    pad2->cd();
00032    pad2->SetTheta(25);
00033    pad2->SetPhi(-110);
00034    pad2->SetLogz();
00035    f2->Draw("surf1");
00036    
00037    //add axis titles. The titles are set on the intermediate
00038    //histogram used for visualisation. We must force this histogram
00039    //to be created, then force the redrawing of the two pads
00040    pad2->Update();
00041    f2->GetHistogram()->GetXaxis()->SetTitle("x title");
00042    f2->GetHistogram()->GetYaxis()->SetTitle("y title");
00043    f2->GetHistogram()->GetXaxis()->SetTitleOffset(1.4);
00044    f2->GetHistogram()->GetYaxis()->SetTitleOffset(1.4);
00045    pad1->Modified();
00046    pad2->Modified();
00047 }

Generated on Tue Jul 5 15:44:22 2011 for ROOT_528-00b_version by  doxygen 1.5.1