Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
hist050_Graphics_candle_plot_options.C File Reference

Detailed Description

View in nbviewer Open in SWAN
Example showing how to combine the various candle plot options.

{
TCanvas *c1 = new TCanvas("c1", "Candle Presets", 800, 600);
c1->Divide(3, 2);
TRandom *rng = new TRandom();
TH2I *h1 = new TH2I("h1", "Sin", 18, 0, 360, 300, -1.5, 1.5);
h1->GetXaxis()->SetTitle("Deg");
float myRand;
for (int i = 0; i < 360; i += 10) {
for (int j = 0; j < 100; j++) {
myRand = rng->Gaus(sin(i * 3.14 / 180), 0.2);
h1->Fill(i, myRand);
}
}
for (int i = 1; i < 7; i++) {
c1->cd(i);
TString str = TString::Format("candlex%d", i);
TH2I *myhist = (TH2I *)h1->DrawCopy(str);
myhist->SetTitle(str);
}
TCanvas *c2 = new TCanvas("c2", "Candle Individual", 800, 600);
c2->Divide(4, 4);
char myopt[16][8] = {"0", "1", "11", "21", "31", "30", "111", "311",
"301", "1111", "2321", "12111", "112111", "212111", "312111"};
for (int i = 0; i < 15; i++) {
c2->cd(i + 1);
TString str = TString::Format("candlex(%s)", myopt[i]);
TH2I *myhist = (TH2I *)h1->DrawCopy(str);
myhist->SetTitle(str);
}
}
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
The Canvas class.
Definition TCanvas.h:23
TAxis * GetXaxis()
Definition TH1.h:340
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
Definition TH1.cxx:3315
virtual TH1 * DrawCopy(Option_t *option="", const char *name_postfix="_copy") const
Copy this histogram and Draw in the current pad.
Definition TH1.cxx:3084
2-D histogram with an int per channel (see TH1 documentation)
Definition TH2.h:227
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Definition TNamed.cxx:164
This is the base class for the ROOT Random number generators.
Definition TRandom.h:27
Basic string class.
Definition TString.h:139
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Definition TString.cxx:2378
return c1
Definition legend1.C:41
TH1F * h1
Definition legend1.C:5
return c2
Definition legend2.C:14
Date
December 2017
Author
Georg Troska

Definition in file hist050_Graphics_candle_plot_options.C.