Merge release-4-6 into release-5-0
[alexxy/gromacs.git] / src / gromacs / gmxana / gmx_mdmat.c
index 09900e1ff4e0dafcc67534f0c320cf13f5593c42..029edf26c28abb9980bf2972a55f3cf4386f370f 100644 (file)
@@ -368,20 +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);
-        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)