This macro shows how to create and use linear gradients to fill a histogram or a pad.
void grad(bool use_gl = true)
{
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");
TH1F *
const hist =
new TH1F(
"a1",
"b1", 20, -3., 3.);
}
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
R__EXTERN TStyle * gStyle
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 GetLinearGradient(Double_t angle, const std::vector< Int_t > &colors, const std::vector< Double_t > &positions={})
Static function: Returns the linear gradient color number corresponding to specified parameters.
static Int_t GetRadialGradient(Double_t r, const std::vector< Int_t > &colors, const std::vector< Double_t > &positions={})
Static function: Returns the radial gradient color number corresponding to specified parameters.
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)
virtual void FillRandom(TF1 *f1, Int_t ntimes=5000, TRandom *rng=nullptr)
void Draw(Option_t *option="") override
Draw this histogram with options.
void SetCanvasPreferGL(Bool_t prefer=kTRUE)
void SetStatColor(Color_t color=19)