This macro demonstrates how to create and use linear gradients to fill a histogram or a pad.
ؐ␜
void grad(bool use_gl = true)
{
gStyle->SetCanvasPreferGL(use_gl);
TCanvas *cnv =
new TCanvas(
"grad",
"gradient demo 1", 100, 100, 600, 600);
::Warning(
"grad",
"This macro requires either OpenGL or Web canvas to correctly handle gradient colors");
gStyle->SetStatColor(statGradient);
TH1F *
const hist =
new TH1F(
"a1",
"b1", 20, -3., 3.);
}
float Float_t
Float 4 bytes (float).
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
void SetFrameFillColor(Color_t color=1)
Bool_t IsWeb() const override
Is web canvas.
static Int_t GetRadialGradient(Double_t r, const std::vector< Int_t > &colors, const std::vector< Double_t > &positions={})
static Int_t GetLinearGradient(Double_t angle, const std::vector< Int_t > &colors, const std::vector< Double_t > &positions={})
static Int_t GetColor(const char *hexcolor)
1-D histogram with a float per channel (see TH1 documentation)
virtual void FillRandom(TF1 *f1, Int_t ntimes=5000, TRandom *rng=nullptr)
void Draw(Option_t *option="") override
Draw this histogram with options.
- Authors
- Timur Pocheptsov, Sergey Linev
Definition in file grad.C.