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$
1
  • $\begingroup$ What's the problem? f[-3] = -2. Also use := not =. $\endgroup$ Sep 1, 2018 at 0:23

1 Answer 1

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$
3
  • 1
    $\begingroup$ Add in CapForm["Round"] for good measure. $\endgroup$ Sep 1, 2018 at 2:51
  • $\begingroup$ Thank you so much. This is so helpful :) $\endgroup$
    – Mini Lee
    Sep 1, 2018 at 11:06
  • $\begingroup$ @MiniLee I am glad it was helpful :) $\endgroup$
    – ubpdqn
    Sep 1, 2018 at 11:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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