TLegend color assignments

Hi,

Questions on TLegend color assingment. With the code

legend = new TLegend(0.6,0.7,0.89,0.89);
  legend -> SetHeader("Legend (odd shift)");
  legend -> AddEntry(g0,"offs 0.0 microns", "l");
  legend -> AddEntry(g1,"offs 0.1 microns", "l");
  legend -> AddEntry(g2,"offs 0.2 microns", "l");
  legend -> AddEntry(g3,"offs 0.3 microns", "l");
  legend -> Draw();

I would like to assign line colors to TGraphs g0,g1,g2,g3 in my Legend. Somewhere in my code, color assignments were done for each TGraphs (ie SetLineColor and SetMarkerColor) and it worked fine in the graph.

The thrid argument, “l”, of AddEntry does not seem to work for me at TLegend. My color results at the legend panel ended up with the color assigned to g0s. Should this “l” argument not be taking care of the color assignments? Or maybe is there something equivalent for SetLineColor and SetMarkerColor in TLegend…
Thanks.
Frances

[code]{
TCanvas *c = new TCanvas(“c”, “c”, 444, 444);

const Int_t n = 20;
Double_t x[n], y[n], ex[n], ey[n];
for (Int_t i = 0; i < n; i++) {
x[i] = i * 0.1;
y[i] = 1000.0 * sin(x[i] + 0.2);
x[i] = 17.8 * x[i] - 8.9;
ex[i] = 1.0;
ey[i] = 10.0 * i;
}

TGraphErrors *gr0 = new TGraphErrors(n, x, y, ex, ey);
gr0->SetLineColor(kRed);
gr0->SetLineWidth(8);
gr0->SetMarkerStyle(21);
gr0->SetMarkerColor(kBlack);
gr0->SetMarkerSize(2);
gr0->Draw(“AP”);

TGraphErrors *gr1 = new TGraphErrors(*gr0);
gr1->SetLineColor(kGreen);
gr1->SetLineWidth(6);
gr1->SetMarkerColor(kRed);
gr1->SetMarkerSize(1.5);
gr1->Draw(“P SAME”);

TGraphErrors *gr2 = new TGraphErrors(*gr0);
gr2->SetLineColor(kBlue);
gr2->SetLineWidth(4);
gr2->SetMarkerColor(kGreen);
gr2->SetMarkerSize(1);
gr2->Draw(“P SAME”);

TGraphErrors *gr3 = new TGraphErrors(*gr0);
gr3->SetLineColor(kBlack);
gr3->SetLineWidth(2);
gr3->SetMarkerColor(kBlue);
gr3->SetMarkerSize(0.5);
gr3->Draw(“P SAME”);

leg = new TLegend(0.1, 0.7, 0.44, 0.9);
leg->SetHeader(“The Legend Title”);
leg->AddEntry(gr0, “Graph 0 with error bars”, “lep”);
leg->AddEntry(gr1, “Graph 1 with error bars”, “lep”);
leg->AddEntry(gr2, “Graph 2 with error bars”, “lep”);
leg->AddEntry(gr3, “Graph 3 with error bars”, “lep”);
leg->Draw();
}[/code]

thank you.