1
$\begingroup$

This question already has an answer here:

I'd like to ask you about the way to plot discontinuous function $\frac{2-x}{|x-2|}(x + 2)$.

What Wolfram Alpha produces:

enter image description here

"DIY" version is below. How to achieve similar effect in Mathematica?

enter image description here

$\endgroup$

marked as duplicate by J. M. will be back soon Oct 28 '15 at 20:05

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

4
$\begingroup$

Use Exclusions and Epilog.

Plot[(2 - x) (x + 2)/Abs[x - 2], {x, 0, 4},
 Exclusions -> {2},
 Epilog -> {Red, Text[○, #] & /@ {{2, 4}, {2, -4}}}]

or

Plot[f[x], {x, 0, 4},
 Exclusions -> {2},
 Epilog -> {Red, Text[○, #] & /@ {
     {2, Limit[f[x], x -> 2, Direction -> 1]},
     {2, Limit[f[x], x -> 2, Direction -> -1]}}}]

enter image description here

$\endgroup$

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