Mathematica Q&A: Excluding Points from Plots
March 14, 2011 — Andrew Moylan, Technical Communication & Strategy
Got questions about Mathematica? The Wolfram Blog has answers! Each week, we’ll answer a selected question from users around the web. You can submit your question directly to the Q&A Team.
For our first post in this new series of Mathematica Q&A articles, we’re going to address a very frequently asked question about plotting in Mathematica.
How can I control the appearance of discontinuities in a plot?
By default, Plot shows the function 1 ⁄ sin(x) with lines joining its discontinuities:
You can use the Exclusions option to exclude points from the plot:
Instead of excluding the points, you can specify a style to apply to them:
For explicitly piecewise functions like Floor, points are excluded automatically:
The exclusions options work with many other Mathematica functions, such as Plot3D:
We specified two styles using ExclusionsStyle: the first style is applied to the excluded region, while the second style is applied to its boundary.
You can create some spectacular visualizations with these options. Download the Computable Document Format (CDF) file for this post to see how to generate this one:
And don’t forget you can submit your own questions to the Q&A Team anytime.