A very common feature of graphs of functions used throughout textbooks are simple indications, such as open circles, of the points at which a function is undefined. Is there a way to do this in Mathematica?

I understand that I can use Epilog (or Prolog, or other explicit drawing graphics functions) to "manually" draw these elements, but us there a way to automatically do this, or at least return the coordinates of such points for use as arguments to Epilog?


2 Answers 2


By using Exclusions and ExclusionsStyle like this

Plot[1/Sin[π x], {x, -3, 3},
  Exclusions -> Sin[π x] == 0, 
  ExclusionsStyle -> {Thin, Directive[Red, PointSize[0.02]]}

you can define the location of the discontinuities and the style for poles and discontinuity boundaries, respectively.

Exclusionsstyle example image

Also the Wolfram Blog, March 2011 has more examples on this topic.

  • $\begingroup$ Why won't this work with Sin[x]/x, {x, -10, 10}, Exclusions -> {0}? $\endgroup$
    – orome
    Commented Jan 17, 2012 at 21:46
  • $\begingroup$ actually, i don't know. But in this case you can get a more consistent result by specifying the points to be excluded by an implicit equation: Exclusions -> Sin[\[Pi] x]==0. I'll update the answer accordingly. $\endgroup$ Commented Jan 17, 2012 at 21:56
  • 1
    $\begingroup$ @raxacoricofallapatorius: In that case I would use Exclusions->x == 0. $\endgroup$ Commented Jan 18, 2012 at 0:38
  • $\begingroup$ @raxacoricofallapatorius - note that an exclusion is not necessary if you use Sinc[x] rather than Sin[x]/x. $\endgroup$
    – Bob Hanlon
    Commented Feb 21, 2015 at 18:18
  • $\begingroup$ @BobHanlon: Yes, but that's not the question. $\endgroup$
    – orome
    Commented Feb 21, 2015 at 19:58

You can use the ExclusionsStyle option to control how Mathematica renders regions excluded from the Plot.

Edit Doing something like ExclusionsStyle -> {None, {{Black, PointSize[Large]}}} will put a large point at the excluded points. For example, modifying a function from the help documentation:

Mathematica graphics

  • $\begingroup$ As near as I can tell, that simply changes how that segment of the graph is drawn (e.g. by omitting a single pixel in the figure), and provides no way to "exaggerate" the relevant points so they can be clearly seen. $\endgroup$
    – orome
    Commented Jan 17, 2012 at 21:36
  • $\begingroup$ I've updated with another option. The second entry in that options list sets the boundary style for the exclusion. $\endgroup$
    – Eli Lansey
    Commented Jan 17, 2012 at 21:38

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.