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);
h->Fill(
gRandom->Gaus(0.5 * nx, 0.2 * nx));
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);
}
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
R__EXTERN TRandom * gRandom
R__EXTERN TStyle * gStyle
static Int_t GetColor(const char *hexcolor)
Static method returning color number for color specified by hex color string of form: "#rrggbb",...
1-D histogram with a float per channel (see TH1 documentation)
A Pave (see TPave) with text, lines or/and boxes inside.
- Author
- Timur Pocheptsov
Definition in file transp_text.C.