fillrandom.C: Fill a 1-D histogram from a parametric function | Histograms | h1draw.C: 1-D histogram drawing options |
{ // Create grey scale of nxn boxes. //Author: Olivier Couet if (gVirtualX) { Int_t n; gVirtualX->GetPlanes(n); if (n < 15) { printf("Not enough color planes to run this script\n"); return; } } TCanvas *c = new TCanvas("grey", "Grey Scale", 500, 500); c->SetBorderMode(0); Int_t n = 200; // tunable parameter Float_t n1 = 1./n; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { TBox *b = new TBox(n1*j, n1*(n-1-i), n1*(j+1), n1*(n-i)); Float_t grey = Float_t(i*n+j)/(n*n); b->SetFillColor(TColor::GetColor(grey, grey, grey)); b->Draw(); } } TPad *p = new TPad("p","p",0.3, 0.3, 0.7,0.7); const char *guibackground = gEnv->GetValue("Gui.BackgroundColor", ""); p->SetFillColor(TColor::GetColor(guibackground)); p->Draw(); p->cd(); TText *t = new TText(0.5, 0.5, "GUI Background Color"); t->SetTextAlign(22); t->SetTextSize(.09); t->Draw(); c->SetEditable(kFALSE); } greyscale.C:1 greyscale.C:2 greyscale.C:3 greyscale.C:4 greyscale.C:5 greyscale.C:6 greyscale.C:7 greyscale.C:8 greyscale.C:9 greyscale.C:10 greyscale.C:11 greyscale.C:12 greyscale.C:13 greyscale.C:14 greyscale.C:15 greyscale.C:16 greyscale.C:17 greyscale.C:18 greyscale.C:19 greyscale.C:20 greyscale.C:21 greyscale.C:22 greyscale.C:23 greyscale.C:24 greyscale.C:25 greyscale.C:26 greyscale.C:27 greyscale.C:28 greyscale.C:29 greyscale.C:30 greyscale.C:31 greyscale.C:32 greyscale.C:33 greyscale.C:34 greyscale.C:35 greyscale.C:36 greyscale.C:37 greyscale.C:38 greyscale.C:39 |
|