Thanks very much Rene, I traced the problem to a line in my rootlogon.C
gROOT->ForceStyle();
Once this was removed my colours persisted when later opening a root file. It did however lead to another small issue; if I add a TLegend, as in the below code, each key entry now seems to have a black background, rather than the usual white. This is seems to be due to the TGraphErrors strangely being set to have their Fill colour set to black. I know this can be changed back to white with the SetFillColor(kWhite) method on each graph individually, but is there a way of using gStlye to correct this when I create the graphs (I practice I tend to draw and save a lot of graphs)?
Again, thanks for your time,
Adam
[code]int graphProb()
{
gStyle->SetFillColor(kWhite);
Double_t x = 0.0, y = 0.0, z=0.0, sigx = 0.5, sigy = 0.5, sigz = 0.5;
TFile f1(“out.root”,“recreate”);
TCanvas * can1 = new TCanvas();
can1->SetName(“can1”);
TTree * t1 = new TTree(“t1”,“tree”);
t1->Branch(“x”,&x,“x/D”);
t1->Branch(“sigx”,&sigx,“sigx/D”);
t1->Branch(“y”,&y,“y/D”);
t1->Branch(“sigy”,&sigy,“sigy/D”);
t1->Branch(“z”,&z,“z/D”);
t1->Branch(“sigz”,&sigz,“sigz/D”);
t1->Fill();
x = 1.0;
y = 1.0;
z = 2.0;
t1->Fill();
x = 2.0;
y = 4.0;
z = 8.0;
t1->Fill();
x = 3.0;
y = 9.0;
z = 18.0;
t1->Fill();
t1->Draw(“x:z:sigx:sigz”,"",“goff”);
TGraphErrors *gr1 = new TGraphErrors(t1->GetSelectedRows(),t1->GetV1(),t1->GetV2(),t1->GetV3(),t1->GetV4());
gr1->SetMarkerColor(kRed);
gr1->SetMarkerStyle(21);
gr1->SetName(“gr1”);
gr1->Draw(“AP”);
t1->Draw(“x:y:sigx:sigy”,"",“goff”);
TGraphErrors *gr2 = new TGraphErrors(t1->GetSelectedRows(),t1->GetV1(),t1->GetV2(),t1->GetV3(),t1->GetV4());
gr2->SetMarkerColor(kBlue);
gr2->SetMarkerStyle(21);
gr2->SetName(“gr2”);
gr2->Draw(“P”);
TLegend * leg1 = new TLegend(0.2,0.65,0.3,0.8);
leg1->AddEntry(gr1,“gr1”);
leg1->AddEntry(gr2,“gr2”);
leg1->Draw();
gr1->Write();
gr2->Write();
can1->Write();
}[/code]