Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

up vote 20 down vote accepted

By using Exclusions and ExclusionsStyle like this

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

you can define a style for poles and discontinuities.

Exclusionsstyle example image

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

share|improve this answer
    
Why won't this work with Sin[x]/x, {x, -10, 10}, Exclusions -> {0}? –  raxacoricofallapatorius Jan 17 '12 at 21:46
    
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. –  Thies Heidecke Jan 17 '12 at 21:56
1  
@raxacoricofallapatorius: In that case I would use Exclusions->x == 0. –  Mike Bantegui Jan 18 '12 at 0:38

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

share|improve this answer
    
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. –  raxacoricofallapatorius Jan 17 '12 at 21:36
    
I've updated with another option. The second entry in that options list sets the boundary style for the exclusion. –  Eli Lansey Jan 17 '12 at 21:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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