#2905 Lines outside of graph bounds with bounded autoscaling
Minimal example, tested in both gnuplot 5.4 and 6.0:
set term dumb
set yrange [: * < 40]
plot 35 - x
Results in something like the following (or attached png if run with a png terminal)
****
40 +---------------------------------------------------------------------+
| +*** + + |
38 |-+ *** 35 - x *******-|
| *** |
| *** |
36 |-+ **** +-|
| *** |
34 |-+ *** +-|
| *** |
| *** |
32 |-+ *** +-|
| *** |
30 |-+ *** +-|
| *** |
| *** |
28 |-+ *** +-|
| *** |
26 |-+ *** +-|
| ***|
| + + + |
24 +---------------------------------------------------------------------+
-10 -5 0 5 10
Disabling autoscaling of the lower bound makes it correctly graph only in the bounded region. Plotting something that remains inside the bounded region before the thing that goes outside the region (e.g. "plot x + 10, 35 - x" in this example) makes it graph correctly.
Diff:
Found the issue using claude. When autoscaling starts, min is initialized to VERYLARGE. The first data point is then guaranteed to be set as the min value. However, if it's above the maximum allowable upper bound, so the max is clamped appropriately. This temporarily results in min > max, but the points are still considered as INRANGE, so they are drawn. When eventually a data point that is actually in the intended range is found, min is updated so that it's sane (less than max), and the final axis is drawn correctly.
Patch generated accordingly, passes locally
Applied. Thanks.