This macro is based on labels1.C by Rene Brun.
Updated by Timur Pocheptsov to use transparent text (12/10/2012). Requires OS X and ROOT configured with –enable-cocoa.
void transp_text(bool gl = true)
{
gStyle->SetCanvasPreferGL(gl);
auto c1 =
new TCanvas(
"transp_text",
"transparent text demo", 10, 10, 900, 500);
if (!
c1->UseGL() && !
c1->IsWeb())
::Warning(
"transp_text",
"to use this macro you need either OpenGL or Web");
c1->SetBottomMargin(0.15);
const char *people[nx] = {"Jean", "Pierre", "Marie", "Odile", "Sebastien", "Fons", "Rene",
"Nicolas", "Xavier", "Greg", "Bjarne", "Anton", "Otto", "Eddy",
"Peter", "Pasha", "Philippe", "Suzanne", "Jeff", "Valery"};
auto h =
new TH1F(
"h4",
"test", nx, 0, nx);
for (
Int_t i = 0; i < 5000; ++i)
h->Fill(
gRandom->Gaus(0.5 * nx, 0.2 * nx));
for (
Int_t i = 1; i <= nx; ++i)
h->GetXaxis()->SetBinLabel(i, people[i - 1]);
auto pt =
new TPaveText(0.3, 0.3, 0.98, 0.98,
"brNDC");
pt->SetFillColor(grayColorIndex);
pt->SetTextColor(blackColorIndex);
}
int Int_t
Signed integer 4 bytes (int).
float Float_t
Float 4 bytes (float).
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
static Int_t GetColor(const char *hexcolor)
1-D histogram with a float per channel (see TH1 documentation)
- Author
- Timur Pocheptsov
Definition in file transp_text.C.