Debian Codegraph @

texmf-dist/doc/latex/svg/root.C

raw
1 void root() {
2
3 // Set the style.
4 gStyle->SetTextFont(80); gStyle->SetLabelFont(80,"XYZ");
5 gStyle->SetTitleFont(80,""); gStyle->SetTitleFont(80,"XYZ");
6 gStyle->SetPalette(1); gStyle->SetOptStat(0);
7
8 // Draw the plot.
9 TH2D *h = new TH2D("", "", 25, 0, 3.9, 25, 0, 3.9); TRandom r;
10 for (int i = 0; i < 30000; i++) h->Fill(r.Gaus(2.,1), r.Gaus(2.,1));
11 h->GetXaxis()->CenterTitle(); h->GetXaxis()->SetTitleOffset(2.5);
12 h->GetYaxis()->CenterTitle(); h->GetYaxis()->SetTitleOffset(2.5);
13 h->GetXaxis()->SetTitle("\\larger[2]$x$");
14 h->GetYaxis()->SetTitle("\\larger[2]$y$");
15 h->Draw("LEGO2");
16
17 // Draw additional text.
18 TText *t = new TText(); t->SetTextAlign(31);
19 t->DrawText(0.7, 0.9, "\\larger[2]$z(x,y) = \\frac{1}{\\sigma_x\\sigma_y"
20 "\\sqrt{4\\pi^2}}\\exp\\left(- \\left(\\frac{(x-\\mu_x)^2}"
21 "{2\\sigma_x^2} + \\frac{(y-\\mu_y)^2}{2\\sigma_y^2} \\right)"
22 "\\right)$");
23
24 // Print the plot.
25 gPad->Print("root.svg");
26
27 }