Suppose game = -2 at the time your program runs. Then if(game>5) would be false, so the "else" would take effect, setting plot_axis_x1=-1 . Then you have plot_axis_x2=game; which would (in this hypothetical situation) be -2. Your axes() call would then be trying to set the x axis to [-1 -2] which would not be allowed.
However we see the error message is about YLim, which you have set with the pair min(tA,min(tB,tC)) - 50 and max(tA,max(tB,tC)) + 50 . One might think that could hardly go wrong along the same kinds of lines that I just showed could be a problem with x. But look more carefully:
- suppose tA, tB, and tC are all NaN, then the min() and max() would give back NaN, and Nan-50 and Nan+50 would both be NaN, leading to a situation where the second value was not greater than the first
- suppose tA, tB, and tC are all inf or all -inf, then the min() and max() would give back that inf or -inf, and inf +/- 50 is inf and -inf +/- 50 is -inf, so you would get a situation where the values are equal...
- suppose that the absolute values involved exceed approximately 1.15E+18 . Then because values have a finite precision, the value minus 50 and the value plus 50 are all the same number to within floating point precision. Then the second value would be bitwise equal to the first value, which would not be greater than the first value.