hello
i’ have a probleme in saving figures with the extension .gif. in fact i get this message :
"Error in TASImage::WriteImage: error writing file figures/isothray5000.gif"
Thank you
What are you doing exactly ?
Does the directory “figures” exists in the current working directory ?
If yes to you have the right to write there ?
hello
i want to use root just to draw figure 2D (contours). i use this code[code]
void isother(){
gStyle->SetOptStat(0);
gStyle->SetOptTitle(1);
gStyle->SetOptFit(0);
gStyle->SetStatY(0.88);
Int_t N=250,M=30;
Float_t x[250][30];
Float_t y[250][30];
Float_t ther[250][30];
ifstream file("results/isothre5da02ray1005100001.dat");
//ifstream file(“results/strfre5da02ray1005100001.dat”);
TH2D *h = new TH2D("h","h",250,1,250,30,1,30);
for(Int_t i=0;i<N;i++){
for(Int_t j=0;j<M;j++){
file>>x[i][j]>>y[i][j]>>ther[i][j];
cout<<x[i][j]<<" "<<y[i][j]<<" "<<ther[i][j]<<endl;
h->Fill(x[i][j],y[i][j],ther[i][j]);
}
}
/// cette methode consiste a tracer un graph
//TCanvas *c1=new TCanvas("c1","c1",800,600);
//c1->SetGridx();
//c1->SetGridy();
//TGraph2D *gr=new TGraph2D(N,x,y,z);
//gr->Draw("P0");
TCanvas *c1=new TCanvas("c1","c1",800,600);
h->GetXaxis()->SetTitle("x");
h->GetYaxis()->SetTitle("y");
// h->Draw(“colz”);
// h->Draw(“contz”);
// h->Draw(“surf3”);
h->Draw(“cont1”);
/*TImageDump *imgdump = new TImageDump(“strf.gif”);
c1->Paint();
imgdump->Close();
*/
c1->Print(“figures/isothray1005.ps”);
//c1->Print(“figures/strfthray1005.ps”);
//c1->Print(“figures/strfthray1000contz.ps”);
//c1->Print(“figures/strfthray1000surf2.ps”);
//c1->Print(“figures/strfthray1000surf3.ps”);
}[/code]
the directory “figure” exists in current working directory.
i have ununtu 14.04 LTS
thank you
This one works for me. No problem to make the PS file.
Can you try ?
void isother(){
gStyle->SetOptStat(0);
gStyle->SetOptTitle(1);
gStyle->SetOptFit(0);
gStyle->SetStatY(0.88);
TH2D *h = new TH2D("h","h",250,1,250,30,1,30);
TCanvas *c1=new TCanvas("c1","c1",800,600);
h->GetXaxis()->SetTitle("x");
h->GetYaxis()->SetTitle("y");
h->Draw("cont1");
c1->Print("figures/isothray1005.ps");
}
note that the directory is “figures” not “figure”
hello
yes i can find the PS file but my problem is with the GIF. also i can’t open the ps file with simple click i should do it with gv
can you help me please
thank you
Your macro generated a PS file … so I used that…
Now I tried with a gif file doing:
c1->Print("figures/isothray1005.gif");
No problem. It works also …
Regarding the PS file opening, that’s not a ROOT issue. You should tell your system what to do when you click on a PS file. You are using ubuntu. You should have some settings somewhere allowing to do that.