Re: [ROOT] TStyle for color settings behaves weird - some news

From: Rene Brun (Rene.Brun@cern.ch)
Date: Sat Mar 03 2001 - 16:43:08 MET


Hi Thomas,
Difficult to issue a diagnostic without looking at your real code.
However, let's try this:
At the end of your job where you do canvas->Print("file.eps");
add the statement canvas->Print("file.root");
and send me the file.root as a mail attachment.
You can also check yourself by running the following interactive session:
 root > TFile f("file.root")
 root > canvas.Draw()

Rene Brun
 

On Sat, 3 Mar 2001, Thomas Feser wrote:

> 
> 
> Hi Rene,
> 
>   thanks for your reply.
>   I indeed mean gROOT->ForceStyle(); (not gStyle->...)
>   Turning my code into a macro is a little complicated... instead I tried
> to run the stuff in interactive mode. The outcome is a perfect looking
> canvas holding my graphs in the colors I set.
>   Only the .eps file printed by 
>  	pad->Print("test.eps","eps");
> is "black on black", no matter what I throw out of the code. Any ideas
> on that?
>   _
>   |om
> 
> 
> > Hi Thomas,
> > I have difficulties in trying to understand your explanations and I am
> > also
> > confused by your code, eg gStyle->ForceStyle() cannot work.
> > I suppose you mean gROOT->ForceStyle();
> > 
> > Could you send a macro that I can run in the modes you describe?
> > 
> > Rene
> > 
> > On Fri, 2 Mar 2001, Thomas Feser wrote:
> > 
> > > 
> > >   I'm currently encountering a very mysterious behaviour of Canvas & Pad 
> > > colors. What I'm doing is the following (root version 3.00.05):
> > > 
> > > 	TApplication theApp("App", &argc, argv);
> > > 	gROOT->SetBatch();       // don't go into interactive mode
> > > 
> > > 	gStyle->SetFrameFillColor(10);
> > > 	gStyle->SetPadBorderMode(1);    
> > > 	gStyle->SetPadColor(10);
> > > 	gStyle->SetCanvasBorderMode(1); 
> > > 	gStyle->SetCanvasColor(10);
> > > 	gROOT->ForceStyle();
> > > 
> > > 	TCanvas *window = new TCanvas("window", "window", -1, 0, 800,600);
> > > 	window->Draw();
> > > 	TPad *pad = new TPad ("pad", "pad", 0.04, 0.02, 1.00, 1.00, 1);
> > > 	TGraphErrors *graph[noofnames];
> > > 	TFile *f = new TFile(rootfilename,"READ","rootfile",9);
> > > 	f->cd();
> > > 	
> > > 	int graph_color[]={  2, 3, 4, 6, 7,18,28,38,48,30};
> > > 	int graph_marker[]={ 30, 4,25,26,27,28,20,21,22,23};
> > > 	// read out graphs from a file
> > > 	for (int i = 0; i < noofgraphs; i++) {
> > > 		sprintf(objpath, "%s/%s", objdir, objnames[i]);
> > > 		graph[i] = (TGraphErrors*)f->Get(objpath);
> > > 		graph[i]->SetMarkerStyle(graph_marker[i]);
> > > 		graph[i]->SetMarkerSize(.8);
> > > 		graph[i]->SetMarkerColor(graph_color[i]);
> > > 
> > > 	}
> > > 	f->close();
> > > 	pad->cd();
> > > 	TH1F *h = new TH1F("h", "title", 680, 1, 681);
> > > 	graph[0]->SetHistogram(h);
> > > 	h->GetXaxis()->SetRange(xmin, xmax);
> > > 	h->SetMinimum(ymin); 
> > > 	h->SetMaximum(ymax);
> > > 	graph[0]->Draw("AP");
> > > 	for (int i = 1; i < noofgraphs; i++)
> > > 		graph[i]->Draw("SAME");
> > > 	pad->Draw();
> > > 	pad->Print("test.eps","eps");
> > > 
> > > 
> > >   I got nice results. Then I started to play a little with
> > > Styles. From then, everything I got out was black. Even after removing
> > > everything about styles from the code (really literally
> > > everything!), all pictures I get are black! Black on
> > > black! Any ideas? Color(10) is white, at least to my knowledge. However, I
> > > also tried many other numbers, even to set an own palette, the result was
> > > the same. 
> > >   Please help!
> > > 
> > >   _
> > >   |om
> > > 
> > > 
> > > ------------------------------------------------------------------------
> > > -     Thomas Feser                                                     -
> > > -                                                                      -
> > > -     Institut fuer Physik                phone: +49-6131-39-25165     -
> > > -     ETAP/AMANDA                           fax: +49-6131-39-25169     -
> > > -     Staudingerweg 7 / 04-426                                         -
> > > -     D-55099 Universitaet Mainz                                       -
> > > -                                                                      -
> > > -     Thomas.Feser@uni-mainz.de                                        -
> > > -     http://iphcip1.physik.uni-mainz.de/~tfeser                       -
> > > ------------------------------------------------------------------------
> > > 
> > 
> 
> 



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:38 MET