Menu

#2860 gnuplot 6.0.4 ignores unset warnings

None
pending-fixed
nobody
None
2026-03-13
2026-03-11
MBoehme
No

As I understood "unset warnings" should suppress warnings. But it looks like this is not working with gnuplot 6.0.4

Here is my example:

$ cat HitsGame_Uzbekistan.gp
unset warnings
set encoding utf8
set title "Top 50 user race for longest hit kilometers - Uzbekistan - chart generated at 2026-03-11 02:02:54"
set terminal pngcairo size 1400,400 enhanced truecolor font 'LiberationSans-Regular,9' background rgb "#f0f0f0"
set auto x
unset xtics
set output "HitsGame_Uzbekistan.png"
set xtics nomirror rotate by -45 scale 0
set style data histogram
set style fill solid border -1
set datafile separator ','
set key box
set grid ytics
set key width 1
plot 'HitsGame_Uzbekistan.dat' u 2:xtic(1) title 'longest valid hit' lc rgb '#0000FF'

data file:

$ cat HitsGame_Uzbekistan.dat
#,longest valid hit
Laurentina,4253
Moise,4253

I still get a warning:

$ gnuplot -p HitsGame_Uzbekistan.gp
Warning: empty y range [4253:4253], adjusting to [4210.47:4295.53]

The generated bar chart is ok.

Does anyone has an idea. Or I'm just misunderstanding the "unset warnings" option?

Discussion

  • Ethan Merritt

    Ethan Merritt - 2026-03-11

    Most, but not all, of the warnings issued by gnuplot were sent by a shared subroutine. The "unset warnings" command silences that shared mechanism. That leaves a few [a quick-and-dirty "grep" of the source tree finds about thirty] places in the source code that print the warning directly rather than going through the shared subroutine. Some of these should probably never by silenced, like the ones from the stats and fit commands that tell you the calculation was invalid or highly unreliable. Others, like the one you point to, could probably be changed to use the shared mechanism. Someone would have to go through the code and evaluate each site to see which case applies.

     
  • MBoehme

    MBoehme - 2026-03-13

    I think I figured it out, here would be a patch:

    diff -Naur gnuplot-6.0.4_orig/src/axis.c gnuplot-6.0.4_patched/src/axis.c
    --- gnuplot-6.0.4_orig/src/axis.c       2025-11-30 23:15:20.000000000 +0100
    +++ gnuplot-6.0.4_patched/src/axis.c    2026-03-13 20:03:47.739548000 +0100
    @@ -433,17 +433,21 @@
                double widen = (dmax == 0.0) ?
                    FIXUP_RANGE__WIDEN_ZERO_ABS
                    : FIXUP_RANGE__WIDEN_NONZERO_REL * fabs(dmax);
    
    -           if (!(axis == FIRST_Z_AXIS && !mesg)) /* set view map */
    -               fprintf(stderr, "Warning: empty %s range [%g:%g], ",
    -                   axis_name(axis), dmin, dmax);
    +            if (!suppress_warnings) {
    +               if (!(axis == FIRST_Z_AXIS && !mesg)) /* set view map */
    +                   fprintf(stderr, "Warning: empty %s range [%g:%g], ",
    +                       axis_name(axis), dmin, dmax);
    +            }
                /* HBB 20010525: correctly handle single-ended autoscaling */
                if ((this_axis->autoscale & AUTOSCALE_MIN) || inside_zoom())
                    this_axis->min -= widen;
                if ((this_axis->autoscale & AUTOSCALE_MAX) || inside_zoom())
                    this_axis->max += widen;
    -           if (!(axis == FIRST_Z_AXIS && !mesg)) /* set view map */
    -               fprintf(stderr, "adjusting to [%g:%g]\n",
    -                   this_axis->min, this_axis->max);
    +            if (!suppress_warnings) {
    +               if (!(axis == FIRST_Z_AXIS && !mesg)) /* set view map */
    +                   fprintf(stderr, "adjusting to [%g:%g]\n",
    +                       this_axis->min, this_axis->max);
    +            }
            } else {
                /* user has explicitly set the range (to something empty) */
                int_error(NO_CARET, "Can't plot with an empty %s range!",
    
     

    Last edit: MBoehme 2026-03-13
    • Ethan Merritt

      Ethan Merritt - 2026-03-13

      Thanks. There's a fix already in 6.1 and queued for 6.0.next

       
  • Ethan Merritt

    Ethan Merritt - 2026-03-13
    • status: open --> pending-fixed
    • Group: -->
    • Priority: -->
     

Log in to post a comment.

MongoDB Logo MongoDB