Let's make an InterpolatingFunction:

if = Interpolation[Transpose[{#, Sin@#} &@Range[0, 4, 0.1]]];

As expected, evaluating it outside of its domain switches from interpolation to extrapolation, giving a pretty wacky result. However, Mathematica helpfully warns you about this

(* InterpolatingFunction::dmval: Input value {10} lies outside the range of data in the interpolating function. Extrapolation will be used. 

36.3612 *)

However, when I go and Plot it, no such warning is offered:

Plot[if[t], {t, 0, 10}]

if blowing right the heck up

This is in Mathematica 12.0+. I have a strong recollection that I used to get warnings when I tried to plot InterpolatingFunctions outside their domain, and if at all possible I would really like to have that behavior back.

  • 2
    $\begingroup$ You could flag it using ColorFunction, e.g., Plot[if[t], {t, 0, 10}, ColorFunction -> Function[{t, f}, If[t > if[[1, 1, -1]], Red, ColorData[97][1]]], ColorFunctionScaling -> False] $\endgroup$
    – Bob Hanlon
    Feb 24, 2021 at 18:13
  • 2
    $\begingroup$ For better or for worse, Plot[] does suppress error messages. Consider the following: test[t_] := If[TrueQ[Between[t, if["Domain"]]], if[t], Message[InterpolatingFunction::dmval, t]; Undefined]; Plot[test[t], {t, 0, 10}] $\endgroup$ Feb 24, 2021 at 19:23
  • 3
    $\begingroup$ You could instead use: if = Interpolation[Transpose[{#, Sin@#} &@Range[0, 4, 0.1]], "ExtrapolationHandler" -> {Indeterminate &, "WarningMessage" -> False}] so that extrapolation is not used. $\endgroup$
    – Carl Woll
    Feb 24, 2021 at 19:31

1 Answer 1


It is not possible to override the Quiet run of the command Plot. However, you can intercept the messages and store them in a list to be browsed afterwards.

For example,

errorlst = {};
Plot[if[t], {t, 0, 10},
 EvaluationMonitor :> 
  If[Length[$MessageList] > 0, 
   AppendTo[errorlst, {$MessageList[[-1]], t}]]

To get the error messages later on, do:

Map[Message[# // Sequence] &, errorlst];

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.