Gradient fill with transparency and the "SAME" option. 
To use this macro you need OpenGL enabled in pad: either set OpenGL.CanvasPreferGL to 1 in $ROOTSYS/etc/system.rootrc; or call gStyle->SetCanvasPreferGL(kTRUE); before canvas created.
 
 
 
void grad2()
{
   
   
   
   
      ::Error(
"grad2", 
"can not allocate new custom colors");
 
      return;
   }
 
   
   const Color_t customRed = freeIndices[0], grad1 = freeIndices[1];
 
   const Color_t customGreen = freeIndices[2], grad2 = freeIndices[3];
 
 
   
 
   
   TCanvas * 
const cnv = 
new TCanvas(
"gradiend demo 2", 
"gradient demo 2", 100, 100, 800, 600);
 
      ::Error(
"grad2", 
"This macro requires OpenGL");
 
      delete cnv;
      return;
   }
 
   
   
   new TColor(customRed, 1., 0., 0., 
"red", 0.5);
 
 
 
 
   
   
   
   
   
   
   
   
 
 
   
 
   
   new TColor(customGreen, 0., 1., 0., 
"green", 0.5);
 
 
   
 
   
 
   TH1F * 
const hist = 
new TH1F(
"a2", 
"b2", 10, -2., 3.);
 
   TH1F * 
const hist2 = 
new TH1F(
"c3", 
"d3", 10, -3., 3.);
 
 
 
}
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
 
R__EXTERN TStyle * gStyle
 
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
 
The color creation and management class.
 
1-D histogram with a float per channel (see TH1 documentation)}
 
virtual void FillRandom(const char *fname, Int_t ntimes=5000, TRandom *rng=nullptr)
Fill histogram following distribution in function fname.
 
void Draw(Option_t *option="") override
Draw this histogram with options.
 
Define a linear color gradient.
 
void SetStartEnd(const Point &p1, const Point &p2)
Set end and start.
 
void SetCanvasPreferGL(Bool_t prefer=kTRUE)
 
unsigned FindFreeCustomColorIndices(T(&indices)[N])