Re: Fill area between two curves

From: Olivier Couet <Olivier.Couet_at_cern.ch>
Date: Wed, 26 Oct 2011 16:49:14 +0000


You can draw the two graphs using the option F (you can do AFL). The first graph will should be drawn with the fill area style and color you want between the 2 graphs . The 2nd graph, drawn on top, should be drawn with a solid fill style and the same color are the TPad color. Then you will have very likely to redraw the axis using gPad->RedrawAxis()

On Oct 14, 2011, at 9:40 AM, Daniel A. Fagundes wrote:

Hi Rooters,
does anybody know how to fill the area defined by two TGraph curves?! For reference I send part of my code:

 TGraph *gr11 = new TGraph(np_teo_pp_mg350,s_sqr_teo_pp_mg350,sig_tot_teo_pp_mg350);

  gr11->SetLineStyle(1);
  gr11->SetLineWidth(2);
  gr11->SetLineColor(1);

  TGraph *gr21 = new TGraph(np_teo_pp_mg400,s_sqr_teo_pp_mg400,sig_tot_teo_pp_mg400);

  gr21->SetLineStyle(1);
  gr21->SetLineWidth(2);
  gr21->SetLineColor(2);

  TMultiGraph *mg1 = new TMultiGraph();

  mg1->Add(gr11);
  mg1->Add(gr21);
  mg1->Draw("AL");

How do I get the area between gr11 and gr21 filled? Thanks in advance,
Daniel.



Daniel Almeida Fagundes
Estudante de Doutorado - PhD Physics Student Universidade Estadual de Campinas - UNICAMP Instituto de Física Gleb Wataghin - IFGW Departamento de Raios Cósmicos e Cronologia - DRCC Grupo Teórico - Fenomenologia das Interações Hadrônicas Sala: 205
Ramal: 5535
Contatos:
Tel: +55 (19) 3521-5535
Cel: +55 (19) 9366-4227

-----------------------------------------------------------------------------------------
Received on Wed Oct 26 2011 - 18:49:21 CEST

This archive was generated by hypermail 2.2.0 : Mon Oct 31 2011 - 17:50:02 CET