From: brouard Date: Wed, 4 Sep 2024 14:25:14 +0000 (+0200) Subject: Some graphs had no y-tics, fixed X-Git-Url: https://henry.ined.fr/git/?a=commitdiff_plain;h=ff3754359f57e5d9304a15276b0663a27c914711;p=.git Some graphs had no y-tics, fixed --- diff --git a/src/imach.c b/src/imach.c index 8f4efa1..f6eb307 100644 --- a/src/imach.c +++ b/src/imach.c @@ -8955,7 +8955,7 @@ void concatwav(int wav[], int **dh, int **bh, int **mw, int **s, double *agedc /* fprintf(ficgp,"\nunset parametric;unset label; set ter png small size 320, 240"); */ fprintf(ficgp,"\nunset parametric;unset label; set ter svg size 640, 480"); /* for(j=nlstate+1; j<= nlstate+ndeath; j++){ *//* Only the first actually */ - fprintf(ficgp,"\n set log y; unset log x;set xlabel \"Age\"; set ylabel \"Force of mortality (year-1)\";"); + fprintf(ficgp,"\n set log y; unset log x;set ytics;set xlabel \"Age\"; set ylabel \"Force of mortality (year-1)\";"); fprintf(ficgp,"\nset out \"%s%s.svg\";",subdirf3(optionfilefiname,"VARMUPTJGR-",digitp),digit); /* fprintf(ficgp,"\n plot \"%s\" u 1:($3*%6.3f) not w l 1 ",fileresprobmorprev,YEARM/estepm); */ /* fprintf(ficgp,"\n replot \"%s\" u 1:(($3+1.96*$4)*%6.3f) t \"95\%% interval\" w l 2 ",fileresprobmorprev,YEARM/estepm); */ @@ -9992,11 +9992,12 @@ prevalence (with 95%% confidence interval) in state (%d): - Total life expectancy by age and \ health expectancies in each live state (1 to %d) with confidence intervals \ on left y-scale as well as proportions of time spent in each live state \ -(with confidence intervals) on right y-scale 0 to 100%%.\ - If popbased=1 the smooth (due to the model) \ -true period expectancies (those weighted with period prevalences are also\ - drawn in addition to the population based expectancies computed using\ - observed and cahotic prevalences: %s_%d-%d.svg",nlstate, subdirf2(optionfilefiname,"E_"),k1,nres,subdirf2(optionfilefiname,"E_"),k1,nres); +(with confidence intervals) on right y-scale 0 to 100%%.",nlstate); + if(popbased==1){ + fprintf(fichtm," As popbased=1, the population based expectancies weighted with observed and cahotic prevalences \ +are drawn in addition to the smooth (due to the model) true period expectancies:"); + } + fprintf(fichtm," %s_%d-%d.svg", subdirf2(optionfilefiname,"E_"),k1,nres,subdirf2(optionfilefiname,"E_"),k1,nres); fprintf(fichtm," (data from text file %s.txt) \n
",subdirf2(optionfilefiname,"T_"),subdirf2(optionfilefiname,"T_")); fprintf(fichtm,"",subdirf2(optionfilefiname,"E_"),k1,nres); /* } /\* end i1 *\/ */ @@ -10316,7 +10317,7 @@ void printinggnuplot(char fileresu[], char optionfilefiname[], double ageminpar, if(TKresult[nres]==0) k1=1; /* To be checked for noresult */ /* if(m != 1 && TKresult[nres]!= k1) */ /* continue; */ - fprintf(ficgp,"\n# 2nd: Total life expectancy with CI: 't' files "); + fprintf(ficgp,"\n# 2nd: Total life expectancy with CI: 'E_' files "); strcpy(gplotlabel,"("); for (k=1; k<=cptcovs; k++){ /* For each covariate k get corresponding value lv for combination k1 */ fprintf(ficgp," V%d=%lg ",Tvresult[nres][k],TinvDoQresult[nres][Tvresult[nres][k]]); @@ -10347,11 +10348,11 @@ void printinggnuplot(char fileresu[], char optionfilefiname[], double ageminpar, fprintf(ficgp,"\nset out \"%s_%d-%d.svg\" \n",subdirf2(optionfilefiname,"E_"),k1,nres); for(vpopbased=0; vpopbased <= popbased; vpopbased++){ /* Done for vpopbased=0 and vpopbased=1 if popbased==1*/ - fprintf(ficgp,"\nset label \"popbased %d %s\" at graph 0.98,0.5 center rotate font \"Helvetica,12\"\n",vpopbased,gplotlabel); - /*if(vpopbased==0){*/ - fprintf(ficgp,"set ylabel \"Years\" \nset ter svg size 640, 480\nunset ytics; unset y2tics; set ytics nomirror; set y2tics 0,10,100;set y2range [0:100];\nplot [%.f:%.f] ",ageminpar,fage); - /*}else*/ - /* fprintf(ficgp,"\nreplot "); */ + fprintf(ficgp,"\nunset label 100;set label 100 \"popbased %d %s\" at graph 0.98,0.5 center rotate font \"Helvetica,12\"\n",vpopbased,gplotlabel); + if(vpopbased==0){ + fprintf(ficgp,"set ylabel \"Years\" \nset ter svg size 640, 480\nunset ytics; unset y2tics; unset y2range; set ytics nomirror; set y2tics 0,10,100;set y2range [0:100];\nplot [%.f:%.f] ",ageminpar,fage); + }else + fprintf(ficgp,"\nreplot "); for (i=1; i<= nlstate+1 ; i ++) { /* For state i-1=0 is LE, while i-1=1 to nlstate are origin state */ k=2*i; fprintf(ficgp,"\"%s\" every :::%d::%d u 1:($2==%d && $4!=0 ?$4 : 1/0) \"%%lf %%lf %%lf",subdirf2(fileresu,"T_"),nres-1,nres-1, vpopbased); /* for fixed variables age, popbased, mobilav */ @@ -10359,9 +10360,15 @@ void printinggnuplot(char fileresu[], char optionfilefiname[], double ageminpar, if (j==i) fprintf(ficgp," %%lf (%%lf)"); /* We want to read e.. i=1,j=1, e.1 i=2,j=2, e.2 i=3,j=3 */ else fprintf(ficgp," %%*lf (%%*lf)"); /* skipping that field with a star */ } - if (i== 1) fprintf(ficgp,"\" t\"TLE\" w l lt %d, \\\n",i); - else fprintf(ficgp,"\" t\"LE in state (%d)\" w l lt %d, \\\n",i-1,i+1); /* state=i-1=1 to nlstate */ - fprintf(ficgp,"\"%s\" every :::%d::%d u 1:($2==%d && $4!=0 ? $4-$5*2 : 1/0) \"%%lf %%lf %%lf",subdirf2(fileresu,"T_"),nres-1,nres-1,vpopbased); + if(vpopbased==0){ + if (i== 1) fprintf(ficgp,"\" t\"TLE\" w l lt %d, \\\n",i); + else fprintf(ficgp,"\" t\"LE in state (%d)\" w l lt %d, \\\n",i-1,i+1); /* state=i-1=1 to nlstate */ + fprintf(ficgp,"\"%s\" every :::%d::%d u 1:($2==%d && $4!=0 ? $4-$5*2 : 1/0) \"%%lf %%lf %%lf",subdirf2(fileresu,"T_"),nres-1,nres-1,vpopbased); + }else{ + if (i== 1) fprintf(ficgp,"\" t\"\" w l lt %d, \\\n",i); + else fprintf(ficgp,"\" t\"\" w l lt %d, \\\n",i+1); /* state=i-1=1 to nlstate */ + fprintf(ficgp,"\"%s\" every :::%d::%d u 1:($2==%d && $4!=0 ? $4-$5*2 : 1/0) \"%%lf %%lf %%lf",subdirf2(fileresu,"T_"),nres-1,nres-1,vpopbased); + } for (j=1; j<= nlstate+1 ; j ++) { if (j==i) fprintf(ficgp," %%lf (%%lf)"); else fprintf(ficgp," %%*lf (%%*lf)"); @@ -10384,10 +10391,16 @@ void printinggnuplot(char fileresu[], char optionfilefiname[], double ageminpar, for (j=1; j<= nlstate+1 ; j ++) { /* e.. e.1 e.2 again j-1 is the state of end, wlim_i eij*/ if (j==i) fprintf(ficgp," %%lf (%%lf)"); /* We want to read e.. i=1,j=1, e.1 i=2,j=2, e.2 i=3,j=3 */ else fprintf(ficgp," %%*lf (%%*lf)"); /* skipping that field with a star */ - } - if (i== 1) fprintf(ficgp,"\" t\"%%TLE\" w l lt %d axis x1y2, \\\n",i); /* Not used */ - else fprintf(ficgp,"\" t\"%%LE in state (%d)\" w l lw 2 lt %d axis x1y2, \\\n",i-1,i+1); /* state=i-1=1 to nlstate */ - fprintf(ficgp,"\"%s\" every :::%d::%d u 1:($2==%d && ($4-$5*2)<=1 && ($4-$5*2)>=0? ($4-$5*2)*100. : 1/0) \"%%lf %%lf %%lf",subdirf2(fileresu,"T_"),nres-1,nres-1,vpopbased); + } + if(vpopbased==0){ + if (i== 1) fprintf(ficgp,"\" t\"%%TLE\" w l lt %d axis x1y2, \\\n",i); /* Not used */ + else fprintf(ficgp,"\" t\"%%LE in state (%d)\" w l lw 2 lt %d axis x1y2, \\\n",i-1,i+1); /* state=i-1=1 to nlstate */ + fprintf(ficgp,"\"%s\" every :::%d::%d u 1:($2==%d && ($4-$5*2)<=1 && ($4-$5*2)>=0? ($4-$5*2)*100. : 1/0) \"%%lf %%lf %%lf",subdirf2(fileresu,"T_"),nres-1,nres-1,vpopbased); + }else{ + if (i== 1) fprintf(ficgp,"\" t\"\" w l lt %d axis x1y2, \\\n",i); /* Not used */ + else fprintf(ficgp,"\" t\"\" w l lw 2 lt %d axis x1y2, \\\n",i+1); /* state=i-1=1 to nlstate */ + fprintf(ficgp,"\"%s\" every :::%d::%d u 1:($2==%d && ($4-$5*2)<=1 && ($4-$5*2)>=0? ($4-$5*2)*100. : 1/0) \"%%lf %%lf %%lf",subdirf2(fileresu,"T_"),nres-1,nres-1,vpopbased); + } for (j=1; j<= nlstate ; j ++) fprintf(ficgp," %%*lf (%%*lf)"); /* Skipping TLE and LE to read %LE only */ for (j=1; j<= nlstate+1 ; j ++) { @@ -10405,9 +10418,10 @@ void printinggnuplot(char fileresu[], char optionfilefiname[], double ageminpar, if (i== (nlstate+1)) fprintf(ficgp,"\" t\"\" w l lt 0 axis x1y2;\n"); else fprintf(ficgp,"\" t\"\" w l lt 0 axis x1y2,\\\n"); } /* state for percent */ - fprintf(ficgp,"unset ytics; unset y2tics; unset y2range; unset label;\n"); /* Otherwise y2tics remained on other graphs */ + /*fprintf(ficgp,"unset ytics; unset y2tics; unset y2range; unset label popbased;\n");*/ /* Otherwise y2tics remained on other graphs */ } /* vpopbased */ - fprintf(ficgp,"\nset out;set out \"%s_%d-%d.svg\"; replot; set out; unset label;\n",subdirf2(optionfilefiname,"E_"),k1,nres); /* Buggy gnuplot */ + fprintf(ficgp,"\n# buggy gnuplot\nset out;set out \"%s_%d-%d.svg\"; replot; set out;\n",subdirf2(optionfilefiname,"E_"),k1,nres); /* Buggy gnuplot */ + fprintf(ficgp,"\nunset ytics; unset y2tics; unset y2range;unset label 100;\n"); /* better place */ } /* end nres */ /* } /\* k1 end 2 eme*\/ */ @@ -10442,7 +10456,7 @@ void printinggnuplot(char fileresu[], char optionfilefiname[], double ageminpar, /* sprintf(gplotlabel+strlen(gplotlabel)," V%d=%f ",Tvqresult[nres][k4],Tqresult[nres][resultmodel[nres][k4]]); */ } strcpy(gplotlabel+strlen(gplotlabel),")"); - fprintf(ficgp,"\n#\n"); + fprintf(ficgp,"\n#\nset ytics\n"); if(invalidvarcomb[k1]){ fprintf(ficgp,"#Combination (%d) ignored because no cases \n",k1); continue; @@ -10451,7 +10465,7 @@ void printinggnuplot(char fileresu[], char optionfilefiname[], double ageminpar, /* k=2+nlstate*(2*cpt-2); */ k=2+(nlstate+1)*(cpt-1); fprintf(ficgp,"\nset out \"%s_%d-%d-%d.svg\" \n",subdirf2(optionfilefiname,"EXP_"),cpt,k1,nres); - fprintf(ficgp,"set label \"%s\" at graph 0.98,0.5 center rotate font \"Helvetica,12\"\n",gplotlabel); + fprintf(ficgp,"unset label;set label \"%s\" at graph 0.98,0.5 center rotate font \"Helvetica,12\"\n",gplotlabel); fprintf(ficgp,"set ter svg size 640, 480\n\ plot [%.f:%.f] \"%s\" every :::%d::%d u 1:%d t \"e%d1\" w l",ageminpar,fage,subdirf2(fileresu,"E_"),nres-1,nres-1,k,cpt); /*fprintf(ficgp,",\"e%s\" every :::%d::%d u 1:($%d-2*$%d) \"\%%lf ",fileres,k1-1,k1-1,k,k+1); @@ -10469,7 +10483,6 @@ plot [%.f:%.f] \"%s\" every :::%d::%d u 1:%d t \"e%d1\" w l",ageminpar,fage,subd } fprintf(ficgp," ,\"%s\" every :::%d::%d u 1:%d t \"e%d.\" w l",subdirf2(fileresu,"E_"),nres-1,nres-1,k+nlstate,cpt); } - fprintf(ficgp,"\nunset label;\n"); } /* end nres */ /* } /\* end kl 3eme *\/ */ @@ -10510,7 +10523,7 @@ plot [%.f:%.f] \"%s\" every :::%d::%d u 1:%d t \"e%d1\" w l",ageminpar,fage,subd } fprintf(ficgp,"\nset out \"%s_%d-%d-%d.svg\" \n",subdirf2(optionfilefiname,"LIJ_"),cpt,k1,nres); - fprintf(ficgp,"set label \"Alive state %d %s\" at graph 0.98,0.5 center rotate font \"Helvetica,12\"\n",cpt,gplotlabel); + fprintf(ficgp,"set ytics;set label \"Alive state %d %s\" at graph 0.98,0.5 center rotate font \"Helvetica,12\"\n",cpt,gplotlabel); fprintf(ficgp,"set xlabel \"Age\" \nset ylabel \"Probability to be alive\" \n\ set ter svg size 640, 480\nunset log y\nplot [%.f:%.f] ", ageminpar, agemaxpar); k=3; @@ -10568,7 +10581,7 @@ set ter svg size 640, 480\nunset log y\nplot [%.f:%.f] ", ageminpar, agemaxpar) } fprintf(ficgp,"\nset out \"%s_%d-%d-%d.svg\" \n",subdirf2(optionfilefiname,"LIJT_"),cpt,k1,nres); - fprintf(ficgp,"set label \"Alive state %d %s\" at graph 0.98,0.5 center rotate font \"Helvetica,12\"\n",cpt,gplotlabel); + fprintf(ficgp,"set ytics;set label \"Alive state %d %s\" at graph 0.98,0.5 center rotate font \"Helvetica,12\"\n",cpt,gplotlabel); fprintf(ficgp,"set xlabel \"Age\" \nset ylabel \"Probability to be alive\" \n\ set ter svg size 640, 480\nunset log y\nplot [%.f:%.f] ", ageminpar, agemaxpar); k=3; @@ -10634,7 +10647,7 @@ set ter svg size 640, 480\nunset log y\nplot [%.f:%.f] ", ageminpar, agemaxpar) } fprintf(ficgp,"\nset out \"%s_%d-%d-%d.svg\" \n",subdirf2(optionfilefiname,"P_"),cpt,k1,nres); - fprintf(ficgp,"set label \"Alive state %d %s\" at graph 0.98,0.5 center rotate font \"Helvetica,12\"\n",cpt,gplotlabel); + fprintf(ficgp,"set ytics;set label \"Alive state %d %s\" at graph 0.98,0.5 center rotate font \"Helvetica,12\"\n",cpt,gplotlabel); fprintf(ficgp,"set xlabel \"Age\" \nset ylabel \"Probability\" \n\ set ter svg size 640, 480\nunset log y\nplot [%.f:%.f] ", ageminpar, agemaxpar); k=3; /* Offset */ @@ -10693,7 +10706,7 @@ set ter svg size 640, 480\nunset log y\nplot [%.f:%.f] ", ageminpar, agemaxpar) fprintf(ficgp,"\nset out \"%s_%d-%d-%d.svg\" \n",subdirf2(optionfilefiname,"PB_"),cpt,k1,nres); fprintf(ficgp,"set label \"Origin alive state %d %s\" at graph 0.98,0.5 center rotate font \"Helvetica,12\"\n",cpt,gplotlabel); - fprintf(ficgp,"set xlabel \"Age\" \nset ylabel \"Probability\" \n\ + fprintf(ficgp,"set ytics;set xlabel \"Age\" \nset ylabel \"Probability\" \n\ set ter svg size 640, 480\nunset log y\nplot [%.f:%.f] ", ageminpar, agemaxpar); k=3; /* Offset */ for (i=1; i<= nlstate ; i ++){ /* State of arrival */ @@ -10895,7 +10908,7 @@ set ter svg size 640, 480\nunset log y\nplot [%.f:%.f] ", ageminpar, agemaxpar) fprintf(ficgp,"# hbijx=backprobability over h years, hb.jx is weighted by observed prev at destination state\n "); fprintf(ficgp,"\nset out \"%s_%d-%d-%d.svg\" \n",subdirf2(optionfilefiname,"PROJB_"),cpt,k1,nres); fprintf(ficgp,"set label \"Origin alive state %d %s\" at graph 0.98,0.5 center rotate font \"Helvetica,12\"\n",cpt,gplotlabel); - fprintf(ficgp,"set xlabel \"Age\" \nset ylabel \"Prevalence\" \n\ + fprintf(ficgp,"set ytic;set xlabel \"Age\" \nset ylabel \"Prevalence\" \n\ set ter svg size 640, 480\nunset log y\nplot [%.f:%.f] ", ageminpar, agemaxpar); /* for (i=1; i<= nlstate+1 ; i ++){ /\* nlstate +1 p11 p21 p.1 *\/ */ @@ -11074,7 +11087,7 @@ set ter svg size 640, 480\nunset log y\nplot [%.f:%.f] ", ageminpar, agemaxpar) strcpy(gplotlabel+strlen(gplotlabel),")"); fprintf(ficgp,"\n#\n"); fprintf(ficgp,"\nset out \"%s_%d-%d-%d.svg\" ",subdirf2(optionfilefiname,"PE_"),k1,ng,nres); - fprintf(ficgp,"\nset key outside "); + fprintf(ficgp,"\nset key outside;set ytics; "); /* fprintf(ficgp,"\nset label \"%s\" at graph 1.2,0.5 center rotate font \"Helvetica,12\"\n",gplotlabel); */ fprintf(ficgp,"\nset title \"%s\" font \"Helvetica,12\"\n",gplotlabel); fprintf(ficgp,"\nset ter svg size 640, 480 "); @@ -11083,10 +11096,10 @@ set ter svg size 640, 480\nunset log y\nplot [%.f:%.f] ", ageminpar, agemaxpar) fprintf(ficgp,"\nunset log y"); }else if (ng==2){ fprintf(ficgp,"\nset ylabel \"Probability\"\n"); - fprintf(ficgp,"\nset log y"); + fprintf(ficgp,"\nset log y; "); }else if (ng==3){ fprintf(ficgp,"\nset ylabel \"Quasi-incidence per year\"\n"); - fprintf(ficgp,"\nset log y"); + fprintf(ficgp,"\nset log y;"); }else fprintf(ficgp,"\nunset title "); fprintf(ficgp,"\nplot [%.f:%.f] ",ageminpar,agemaxpar); @@ -12447,7 +12460,7 @@ void printinggnuplotmort(char fileresu[], char optionfilefiname[], double agemin strcpy(dirfileres,optionfilefiname); strcpy(optfileres,"vpl"); fprintf(ficgp,"set out \"graphmort.svg\"\n "); - fprintf(ficgp,"set xlabel \"Age\"\n set ylabel \"Force of mortality (per year)\" \n "); + fprintf(ficgp,"set ytics;set xlabel \"Age\"\n set ylabel \"Force of mortality (per year)\" \n "); fprintf(ficgp, "set ter svg size 640, 480\n set log y\n"); /* fprintf(ficgp, "set size 0.65,0.65\n"); */ fprintf(ficgp,"plot [%d:100] %lf*exp(%lf*(x-%d))",agegomp,p[1],p[2],agegomp);