Make sure figure legends are adapted to xmgr/xmgrace
[alexxy/gromacs.git] / src / tools / gmx_mdmat.c
index a5df7ef22de39ab761c40b195c4ed449f1e2aa89..3e960a3bdb26a9687795b3f3ed7796440372f558 100644 (file)
@@ -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)