void writeComi(){ FILE *infile,*ofile; char iname[256],oname[256]; int idmy,idmy1; double x,y,z,v,check,check1; double xr[128],yr[128]; sprintf(iname,"sampleQ.txt"); //sprintf(iname,"sampleQ_coil2.txt"); infile=fopen(iname,"r"); sprintf(oname,"Q.comi"); //sprintf(oname,"Q_coil2.comi"); ofile=fopen(oname,"w"); fprintf(ofile,"POLYGON -RELATIVE POLAR=NO\n"); idmy1=1;idmy=1; int kk=0; while(fscanf(infile,"%lf,%lf",&x,&y)==2){ fprintf(ofile," X=%3.2f Y=%3.2f OPTION=TEXT +DATA\n",x,y); xr[kk]=x; yr[kk]=y; kk++; } fprintf(ofile,"OPTION=CLOSE +DATA\n\n"); printf("kk=%d\n",kk); fclose(ofile); TGraph *gr; gr =new TGraph(kk,xr,yr); gROOT->SetStyle("Plain"); gROOT->ForceStyle(); gStyle->SetOptStat(0); gStyle->SetCanvasBorderMode(0); gStyle->SetPadColor(0); gStyle->SetTitleFillColor(0); gStyle->SetStatColor(0); gStyle->SetCanvasBorderMode(0);//remove yellow line gStyle->SetCanvasColor(0); gStyle->SetFrameLineColor(1); gStyle->SetPadColor(0); gStyle->SetTitleFillColor(0); gStyle->SetStatColor(0); //gStyle->SetPalette(52); TCanvas *c = new TCanvas("c","check",200,100,500,500); c->SetLeftMargin(0.1); c->SetRightMargin(0.1); TH2F* frame = new TH2F("frame"," ",10, 0, 20, 100, 0., 20); frame->SetTitle(""); frame->GetXaxis()->SetLabelSize(0.04); frame->GetXaxis()->SetTitleSize(0.05); frame->GetYaxis()->SetLabelSize(0.04); frame->GetYaxis()->SetTitleSize(0.05); frame->GetXaxis()->SetTitle("x"); frame->GetYaxis()->SetTitle("y"); frame->GetYaxis()->SetTitleOffset(1.2); frame->SetStats(0); frame->Draw(); gr->SetMarkerStyle(7); gr->SetMarkerColor(2); gr->Draw("pl"); c->SetGrid(); }