1
$\begingroup$

I tried to graph a function with an undefined point. The example is as below.

f[x_] = (x^2 + x -6) / (-4x^2 - 16x - 12);

Plot[f[x], {x, -3.1, -2.99}]

The output is a curve but there should be a hole ($x$ can't be $-3$) in the curve. Is there any setting in Plot that will show that the curve is undefined at $x = -3$?

$\endgroup$
  • $\begingroup$ What's the problem? f[-3] = -2. Also use := not =. $\endgroup$ – David G. Stork Sep 1 '18 at 0:23
8
$\begingroup$

You can use Exclusions and ExclusionsStyle:

Plot[f[x], {x, -3.1, -2.99}, Exclusions -> True, 
 ExclusionsStyle -> Directive[Thickness[0.02], Red]]

enter image description here

$\endgroup$
  • 1
    $\begingroup$ Add in CapForm["Round"] for good measure. $\endgroup$ – Brett Champion Sep 1 '18 at 2:51
  • $\begingroup$ Thank you so much. This is so helpful :) $\endgroup$ – Mini Lee Sep 1 '18 at 11:06
  • $\begingroup$ @MiniLee I am glad it was helpful :) $\endgroup$ – ubpdqn Sep 1 '18 at 11:28

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.