hsumTimer.C: demo of Timers | Histograms | multicolor.C: Use a THStack to show a 2-D hist with cells with different colors |
void logscales() { //Draw parametric functions with log scales //Author: Olivier Couet TCanvas *c1 = new TCanvas("c1", "Various options on LOG scales plots",0,0,700,900); c1->SetFillColor(30); pad1 = new TPad("pad1","pad1",0.03,0.62,0.50,0.92,32); pad2 = new TPad("pad2","pad2",0.51,0.62,0.98,0.92,33); pad3 = new TPad("pad3","pad3",0.03,0.02,0.97,0.535,38); pad1->Draw(); pad2->Draw(); pad3->Draw(); title = new TPaveLabel(0.1,0.94,0.9,0.98, "Various options on LOG scales plots"); title->SetFillColor(16); title->SetTextFont(42); title->Draw(); pave = new TPaveText(0.1,0.55,0.9,0.61); pave->SetFillColor(42); pave->SetTextAlign(12); pave->SetTextFont(42); pave->AddText("When more Log labels are requested, the overlaping \ labels are removed"); pave->Draw(); pad1->cd(); pad1->SetLogy(); pad1->SetGridy(); TF1 *f1 = new TF1("f1","x*sin(x)*exp(-0.1*x)+15",-10.,10.); TF1 *f2 = new TF1("f2","(sin(x)+cos(x))**5+15",-10.,10.); TF1 *f3 = new TF1("f3","(sin(x)/(x)-x*cos(x))+15",-10.,10.); f1->SetLineWidth(1); f1->SetLineColor(2); f2->SetLineWidth(1); f2->SetLineColor(3); f3->SetLineWidth(1); f3->SetLineColor(4); //f1->SetTitle(""); f1->Draw(); f2->Draw("same"); f3->Draw("same"); f1->GetYaxis()->SetMoreLogLabels(); pave1 = new TPaveText(-6,2,6,6); pave1->SetFillColor(42); pave1->SetTextAlign(12); pave1->SetTextFont(42); pave1->AddText("Log scale along Y axis."); pave1->AddText("More Log labels requested."); pave1->Draw(); pad2->cd(); double x[10] = { 200, 300, 400, 500, 600, 650, 700, 710, 900,1000 }; double y[10] = { 200, 1000, 900, 400, 500, 250, 800, 150, 201, 220 }; g_2 = new TGraph(10,x,y); //g_2->SetTitle(""); g_2->Draw("AL*"); g_2->SetMarkerColor(2); g_2->GetYaxis()->SetMoreLogLabels(); g_2->GetYaxis()->SetNoExponent(); pad2->SetLogy(); g_2->GetXaxis()->SetMoreLogLabels(); pad2->SetLogx(); pad2->SetGridx(); pave2 = new TPaveText(150,80,500,180); pave2->SetFillColor(42); pave2->SetTextFont(42); pave2->SetTextAlign(12); pave2->AddText("Log scale along X and Y axis."); pave2->AddText("More Log labels on both."); pave2->AddText("No exponent along Y axis."); pave2->Draw(); pad3->cd(); pad3->SetGridx(); pad3->SetGridy(); pad3->SetLogy(); pad3->SetLogx(); TF1 *f4 = new TF1("f4a","x*sin(x+10)+25",1,21); f4->SetLineWidth(1); f4->Draw(); f4->SetNpx(200); //f4->SetTitle(""); f4->GetYaxis()->SetMoreLogLabels(); f4->GetXaxis()->SetMoreLogLabels(); f4 = new TF1("f4b","x*cos(x+10)*sin(x+10)+25",1,21); f4->SetLineWidth(1); f4->Draw("same"); f4->SetNpx(200); Int_t a = 20; for (int i=a; i>=1; i--) { f4 = new TF1(Form("f4b_%d",i),"x*sin(x+10)*[0]/[1]+25",1,21); f4->SetParameter(0,i); f4->SetParameter(1,a); f4->SetNpx(200); f4->SetLineWidth(1); f4->SetLineColor(i+10); f4->Draw("same"); f4 = new TF1(Form("f4c_%d",i),"x*cos(x+10)*sin(x+10)*[0]/[1]+25",1,25); f4->SetParameter(0,i); f4->SetParameter(1,a); f4->SetNpx(200); f4->SetLineWidth(1); f4->SetLineColor(i+30); f4->Draw("same"); } pave3 = new TPaveText(1.2,8,9,15); pave3->SetFillColor(42); pave3->AddText("Log scale along X and Y axis."); pave3->SetTextFont(42); pave3->SetTextAlign(12); pave3->AddText("More Log labels on both."); pave3->AddText("The labels have no exponents (they would be 0 or 1)"); pave3->Draw(); } logscales.C:1 logscales.C:2 logscales.C:3 logscales.C:4 logscales.C:5 logscales.C:6 logscales.C:7 logscales.C:8 logscales.C:9 logscales.C:10 logscales.C:11 logscales.C:12 logscales.C:13 logscales.C:14 logscales.C:15 logscales.C:16 logscales.C:17 logscales.C:18 logscales.C:19 logscales.C:20 logscales.C:21 logscales.C:22 logscales.C:23 logscales.C:24 logscales.C:25 logscales.C:26 logscales.C:27 logscales.C:28 logscales.C:29 logscales.C:30 logscales.C:31 logscales.C:32 logscales.C:33 logscales.C:34 logscales.C:35 logscales.C:36 logscales.C:37 logscales.C:38 logscales.C:39 logscales.C:40 logscales.C:41 logscales.C:42 logscales.C:43 logscales.C:44 logscales.C:45 logscales.C:46 logscales.C:47 logscales.C:48 logscales.C:49 logscales.C:50 logscales.C:51 logscales.C:52 logscales.C:53 logscales.C:54 logscales.C:55 logscales.C:56 logscales.C:57 logscales.C:58 logscales.C:59 logscales.C:60 logscales.C:61 logscales.C:62 logscales.C:63 logscales.C:64 logscales.C:65 logscales.C:66 logscales.C:67 logscales.C:68 logscales.C:69 logscales.C:70 logscales.C:71 logscales.C:72 logscales.C:73 logscales.C:74 logscales.C:75 logscales.C:76 logscales.C:77 logscales.C:78 logscales.C:79 logscales.C:80 logscales.C:81 logscales.C:82 logscales.C:83 logscales.C:84 logscales.C:85 logscales.C:86 logscales.C:87 logscales.C:88 logscales.C:89 logscales.C:90 logscales.C:91 logscales.C:92 logscales.C:93 logscales.C:94 logscales.C:95 logscales.C:96 logscales.C:97 logscales.C:98 logscales.C:99 logscales.C:100 logscales.C:101 logscales.C:102 logscales.C:103 logscales.C:104 logscales.C:105 logscales.C:106 logscales.C:107 logscales.C:108 logscales.C:109 logscales.C:110 |
|