From: Erik Lindahl Date: Thu, 12 Jun 2014 12:39:24 +0000 (+0200) Subject: Make sure figure legends are adapted to xmgr/xmgrace X-Git-Url: http://biod.pnpi.spb.ru/gitweb/?a=commitdiff_plain;h=75f84652037affa3e28fcb651a8769c672f736a9;p=alexxy%2Fgromacs.git Make sure figure legends are adapted to xmgr/xmgrace A few programs were not using the xvgr_legend call. g_mdmat has been modified to use it, and for g_analyse and g_enemat I at least fixed the existing direct-writing code by adding a conditional. Fixes #783. Change-Id: I782af539b93737b570f266ba744e718fbd846e5f --- diff --git a/src/tools/gmx_analyze.c b/src/tools/gmx_analyze.c index 2b8f2827b3..b201f94be8 100644 --- a/src/tools/gmx_analyze.c +++ b/src/tools/gmx_analyze.c @@ -615,11 +615,16 @@ static void estimate_error(const char *eefile, int nb_min, int resol, int n, } fprintf(stdout, "Set %3d: err.est. %g a %g tau1 %g tau2 %g\n", s+1, ee, a, tau1, tau2); - if(output_env_get_print_xvgr_codes(oenv)) + if (output_env_get_xvg_format(oenv) == exvgXMGR) { fprintf(fp, "@ legend string %d \"av %f\"\n", 2*s, av[s]); fprintf(fp, "@ legend string %d \"ee %6g\"\n",2*s+1, sig[s]*anal_ee_inf(fitparm, n*dt)); } + else if (output_env_get_xvg_format(oenv) == exvgXMGRACE) + { + fprintf(fp, "@ s%d legend \"av %f\"\n", 2*s, av[s]); + fprintf(fp, "@ s%d legend \"ee %6g\"\n",2*s+1, sig[s]*anal_ee_inf(fitparm, n*dt)); + } for (i = 0; i < nbs; i++) { fprintf(fp, "%g %g %g\n", tbs[i], sig[s]*sqrt(ybs[i]/(n*dt)), diff --git a/src/tools/gmx_enemat.c b/src/tools/gmx_enemat.c index f60972502b..2add7ed450 100644 --- a/src/tools/gmx_enemat.c +++ b/src/tools/gmx_enemat.c @@ -514,20 +514,32 @@ int gmx_enemat(int argc, char *argv[]) j = 0; if (output_env_get_print_xvgr_codes(oenv)) { + char str1[STRLEN],str2[STRLEN]; + if(output_env_get_xvg_format(oenv) == exvgXMGR) + { + sprintf(str1,"@ legend string "); + sprintf(str2," "); + } + else + { + sprintf(str1,"@ s"); + sprintf(str2," legend "); + } + for (m = 0; (m < egNR+egSP); m++) { if (egrp_use[m]) { - fprintf(out, "@ legend string %d \"%s\"\n", j++, egrp_nm[m]); + fprintf(out, "%s%d%s \"%s\"\n", str1, j++, str2, egrp_nm[m]); } } if (bFree) { - fprintf(out, "@ legend string %d \"%s\"\n", j++, "Free"); + fprintf(out, "%s%d%s \"%s\"\n", str1, j++, str2, "Free"); } if (bFree) { - fprintf(out, "@ legend string %d \"%s\"\n", j++, "Diff"); + fprintf(out, "%s%d%s \"%s\"\n", str1, j++, str2, "Diff"); } fprintf(out, "@TYPE xy\n"); fprintf(out, "#%3s", "grp"); diff --git a/src/tools/gmx_mdmat.c b/src/tools/gmx_mdmat.c index a5df7ef22d..3e960a3bdb 100644 --- a/src/tools/gmx_mdmat.c +++ b/src/tools/gmx_mdmat.c @@ -368,23 +368,22 @@ int gmx_mdmat(int argc, char *argv[]) if (bCalcN) { + char **legend; + + snew(legend,5); + for(i=0;i<5;i++) + { + snew(legend[i],STRLEN); + } tot_nmat(nres, natoms, nframes, totnmat, tot_n, mean_n); fp = xvgropen(ftp2fn(efXVG, NFILE, fnm), "Increase in number of contacts", "Residue", "Ratio", oenv); - if(output_env_get_print_xvgr_codes(oenv)) - { - fprintf(fp, "@ legend on\n"); - fprintf(fp, "@ legend box on\n"); - fprintf(fp, "@ legend loctype view\n"); - fprintf(fp, "@ legend 0.75, 0.8\n"); - fprintf(fp, "@ legend string 0 \"Total/mean\"\n"); - fprintf(fp, "@ legend string 1 \"Total\"\n"); - fprintf(fp, "@ legend string 2 \"Mean\"\n"); - fprintf(fp, "@ legend string 3 \"# atoms\"\n"); - fprintf(fp, "@ legend string 4 \"Mean/# atoms\"\n"); - fprintf(fp, "#%3s %8s %3s %8s %3s %8s\n", - "res", "ratio", "tot", "mean", "natm", "mean/atm"); - } + sprintf(legend[0],"Total/mean"); + sprintf(legend[1],"Total"); + sprintf(legend[2],"Mean"); + sprintf(legend[3],"# atoms"); + sprintf(legend[4],"Mean/# atoms"); + xvgr_legend(fp,5,(const char**)legend,oenv); for (i = 0; (i < nres); i++) { if (mean_n[i] == 0)