gnuplot.c, correct the setting of limits in log plots

This commit is contained in:
h_vogt 2017-09-16 00:43:37 +02:00 committed by rlar
parent e9a675efb6
commit b3827f6488
1 changed files with 1 additions and 2 deletions

View File

@ -69,7 +69,7 @@ ft_gnuplot(double *xlims, double *ylims, char *filename, char *title, char *xlab
return; return;
} }
if (fabs((ylims[1]-ylims[0])/ylims[0]) < 1.0e-6) { if (ylims && (fabs((ylims[1]-ylims[0])/ylims[0]) < 1.0e-6)) {
fprintf(cp_err, "Error: range min ... max too small for using gnuplot.\n"); fprintf(cp_err, "Error: range min ... max too small for using gnuplot.\n");
fprintf(cp_err, " Consider plotting with offset %g.\n", ylims[0]); fprintf(cp_err, " Consider plotting with offset %g.\n", ylims[0]);
return; return;
@ -168,7 +168,6 @@ ft_gnuplot(double *xlims, double *ylims, char *filename, char *title, char *xlab
if (xlims) if (xlims)
fprintf(file, "set xrange [%1.0e:%1.0e]\n", fprintf(file, "set xrange [%1.0e:%1.0e]\n",
pow(10, floor(log10(xlims[0]))), pow(10, ceil(log10(xlims[1])))); pow(10, floor(log10(xlims[0]))), pow(10, ceil(log10(xlims[1]))));
fprintf(file, "set xrange [%e:%e]\n", xlims[0], xlims[1]);
fprintf(file, "set mxtics 10\n"); fprintf(file, "set mxtics 10\n");
fprintf(file, "set grid mxtics\n"); fprintf(file, "set grid mxtics\n");
} else { } else {