Wolfram Research

Function Repository Resource:

EnhancedPlot

Source Notebook

Plot with several enhancements added for singularities, asymptotes, surd values and non-interval domains

Contributed by: Dennis M Schneider  |  Dennis M Schneider

ResourceFunction["EnhancedPlot"][f,{x,xmin,xmax}]

returns a plot with several enhancements given by options.

Details and Options

The most significant options are "Asymptote", "Exception", "FindExceptions", "FindAsymptotes", "PowerBehavior" and "ZeroToNull".
Vertical asymptotes can be plotted by setting the "Asymptote" option to a list of x coordinates at which there are infinite (possibly one-sided) discontinuities.
Point discontinuities can be plotted by setting the "Exception" option to a list of x coordinates where possible exceptions occur. Removable discontinuities are denoted by an empty circle. Jump discontinuities are denoted by one or more empty circles at the points of discontinuity (the "jump points"). Infinite discontinuities are drawn as vertical asymptotes. A filled circle is drawn at all other points.
Set "FindExceptions" to True to use ResourceFunction["FunctionDiscontinuities"] to find the discontinuities.
Set "FindAsymptotes" to True to use ResourceFunction["Asymptotes"] to find the various types of asymptotes: "Horizontal", "Vertical", "Oblique", "Parabolic" or "Other".
Set "PowerBehavior" to Real (the default) to insure that odd roots of negative real numbers are returned as negative real numbers instead of the imaginary numbers. Set "PowerBehavior" to Complex to restore the Wolfram Language’s default behavior.
Set "ZeroToNull" to True (the default) to change the Wolfram Language’s default behavior of assigning the value 0 when none of the conditions given in the piecewise function apply to assigning the value Null. Set "ZeroToNull" to False to restore default behavior.
"PointStyle" will not accept color directives.
ResourceFunction["EnhancedPlot"] accepts the following options for adding enhancements:
"Asymptote"{}list of points where the function has vertical asymptotes
"AsymptoteStyle"{{Red,Dashed}}graphics directive to specify the style for each asymptote
"DrawPoint"{}list of points to add to the plot
"DrawPointStyle"AbsolutePointSize[7]graphics directives to specify style(s) for the points given with "DrawPoint"
"Exception"{}list of points where the function has discontinuities
"FindExceptions"Automaticwhether to use ResourceFunction["FunctionDiscontinuities"] to find the discontinuities
"HorizontalAsymptote"{}list of points where horizontal asymptotes should be drawn
"HorizontalAsymptoteStyle"{{Red,Dashed}}graphics directive to specify the style for each horizontal asymptote
"PointStyle"AbsolutePointSize[7]graphics directive to specify the style for the point(s) where the function has a discontinuity; color directives are not allowed
"PowerBehavior"Realodd roots of negative real numbers are returned as negative real numbers
"ZeroToNull"Truewhether to change the default value of a piecewise function from zero to Null
In addition to these options, ResourceFunction["EnhancedPlot"] accepts any of the options for Plot, as well as the option "ExcludeRemovableDiscontinuities" for the resource function FunctionDiscontinuities.

Examples

Basic Examples (8) 

Find the discontinuities and plot a function:

In[1]:=
f[x_] := \[Piecewise] {
   {x^2, x < 1},
   {x^2 + 1, x > 1},
   {1.5, x == 1}
  }
ResourceFunction["EnhancedPlot"][f[x], {x, 0, 2}, "FindExceptions" -> True]
Out[2]=

Explicitly give the discontinuity:

In[3]:=
f[x_] := \[Piecewise] {
   {x^2, x < 1},
   {x^2 + 1, x > 1},
   {1.5, x == 1}
  }
ResourceFunction["EnhancedPlot"][f[x], {x, 0, 2}, "Exception" -> 1]
Out[4]=

Plot a function with a removable discontinuity:

In[5]:=
ResourceFunction["EnhancedPlot"][Sin[x - 1]^2/(x - 1) + 1, {x, -1, 2},
  "FindExceptions" -> True, AxesOrigin -> {0, 0}]
Out[5]=

Explicitly give the discontinuity:

In[6]:=
ResourceFunction["EnhancedPlot"][Sin[x - 1]^2/(x - 1) + 1, {x, -1, 2},
  "Exception" -> 1, AxesOrigin -> {0, 0}]
Out[6]=

Remove the discontinuity:

In[7]:=
Limit[Sin[x - 1]^2/(x - 1) + 1, x -> 1]
Out[7]=
In[8]:=
f[x_] := \!\(\*
TagBox[GridBox[{
{"\[Piecewise]", GridBox[{
{
RowBox[{
FractionBox[
SuperscriptBox[
RowBox[{"Sin", "[", 
RowBox[{"x", "-", "1"}], "]"}], "2"], 
RowBox[{"x", "-", "1"}]], "+", "1"}], 
RowBox[{"x", "!=", "1"}]},
{"1", 
RowBox[{"x", "==", "1"}]}
},
AllowedDimensions->{2, Automatic},
Editable->True,
GridBoxAlignment->{"Columns" -> {{Left}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
GridBoxItemSize->{"Columns" -> {{Automatic}}, "ColumnsIndexed" -> {}, "Rows" -> {{1.}}, "RowsIndexed" -> {}},
GridBoxSpacings->{"Columns" -> {
Offset[
            0.27999999999999997`], {
Offset[0.84]}, 
Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
Offset[0.2], {
Offset[0.4]}, 
Offset[0.2]}, "RowsIndexed" -> {}},
Selectable->True]}
},
GridBoxAlignment->{"Columns" -> {{Left}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
GridBoxItemSize->{"Columns" -> {{Automatic}}, "ColumnsIndexed" -> {}, "Rows" -> {{1.}}, "RowsIndexed" -> {}},
GridBoxSpacings->{"Columns" -> {
Offset[
         0.27999999999999997`], {
Offset[0.35]}, 
Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
Offset[0.2], {
Offset[0.4]}, 
Offset[0.2]}, "RowsIndexed" -> {}}],
"Piecewise",
DeleteWithContents->True,
Editable->False,
SelectWithContents->True,
Selectable->False,
StripWrapperBoxes->True]\)
ResourceFunction["EnhancedPlot"][f[x], {x, -1, 2}, "FindExceptions" -> True, AxesOrigin -> {0, 0}]
Out[9]=

Remove the discontinuity but show the break point:

In[10]:=
f[x_] := \!\(\*
TagBox[GridBox[{
{"\[Piecewise]", GridBox[{
{
RowBox[{
FractionBox[
SuperscriptBox[
RowBox[{"Sin", "[", 
RowBox[{"x", "-", "1"}], "]"}], "2"], 
RowBox[{"x", "-", "1"}]], "+", "1"}], 
RowBox[{"x", "!=", "1"}]},
{"1", 
RowBox[{"x", "==", "1"}]}
},
AllowedDimensions->{2, Automatic},
Editable->True,
GridBoxAlignment->{"Columns" -> {{Left}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
GridBoxItemSize->{"Columns" -> {{Automatic}}, "ColumnsIndexed" -> {}, "Rows" -> {{1.}}, "RowsIndexed" -> {}},
GridBoxSpacings->{"Columns" -> {
Offset[
            0.27999999999999997`], {
Offset[0.84]}, 
Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
Offset[0.2], {
Offset[0.4]}, 
Offset[0.2]}, "RowsIndexed" -> {}},
Selectable->True]}
},
GridBoxAlignment->{"Columns" -> {{Left}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
GridBoxItemSize->{"Columns" -> {{Automatic}}, "ColumnsIndexed" -> {}, "Rows" -> {{1.}}, "RowsIndexed" -> {}},
GridBoxSpacings->{"Columns" -> {
Offset[
         0.27999999999999997`], {
Offset[0.35]}, 
Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
Offset[0.2], {
Offset[0.4]}, 
Offset[0.2]}, "RowsIndexed" -> {}}],
"Piecewise",
DeleteWithContents->True,
Editable->False,
SelectWithContents->True,
Selectable->False,
StripWrapperBoxes->True]\)
ResourceFunction["EnhancedPlot"][f[x], {x, -1, 2}, "Exception" -> 1, AxesOrigin -> {0, 0}]
Out[11]=

Plot a function with an asymptote at x=-1, a horizontal asymptote at y=0, a jump discontinuity at x=2, and a removable discontinuity at x=3:

In[12]:=
Clear[f]
f[x_] := \!\(\*
TagBox[GridBox[{
{"\[Piecewise]", GridBox[{
{
FractionBox["1", 
RowBox[{"1", "+", "x"}]], 
RowBox[{"x", "<", 
RowBox[{"-", "1"}]}]},
{
RowBox[{"x", "-", 
SuperscriptBox["x", "2"]}], 
RowBox[{
RowBox[{"-", "1"}], "<", "x", "<", "2"}]},
{
RowBox[{
FractionBox["1", "2"], 
RowBox[{"(", 
RowBox[{"1", "-", "x"}], ")"}]}], 
RowBox[{"2", "<=", "x", "<", "3"}]},
{
RowBox[{"Cos", "[", 
RowBox[{"\[Pi]", " ", "x"}], "]"}], 
RowBox[{"3", "<", "x", "<", "4"}]}
},
AllowedDimensions->{2, Automatic},
Editable->True,
GridBoxAlignment->{"Columns" -> {{Left}}, "Rows" -> {{Baseline}}},
GridBoxItemSize->{"Columns" -> {{Automatic}}, "Rows" -> {{1.}}},
GridBoxSpacings->{"Columns" -> {
Offset[
            0.27999999999999997`], {
Offset[0.84]}, 
Offset[0.27999999999999997`]}, "Rows" -> {
Offset[0.2], {
Offset[0.4]}, 
Offset[0.2]}},
Selectable->True]}
},
GridBoxAlignment->{"Columns" -> {{Left}}, "Rows" -> {{Baseline}}},
GridBoxItemSize->{"Columns" -> {{Automatic}}, "Rows" -> {{1.}}},
GridBoxSpacings->{"Columns" -> {
Offset[
         0.27999999999999997`], {
Offset[0.35]}, 
Offset[0.27999999999999997`]}, "Rows" -> {
Offset[0.2], {
Offset[0.4]}, 
Offset[0.2]}}],
"Piecewise",
DeleteWithContents->True,
Editable->False,
SelectWithContents->True,
Selectable->False,
StripWrapperBoxes->True]\)
ResourceFunction["EnhancedPlot"][f[x], {x, -4, 4}, "FindExceptions" -> True, "Asymptote" -> -1, "HorizontalAsymptote" -> 0]
Out[14]=

"FindAsymptote" misses the horizontal asymptote at y=0:

In[15]:=
Clear[f]
f[x_] := \!\(\*
TagBox[GridBox[{
{"\[Piecewise]", GridBox[{
{
FractionBox["1", 
RowBox[{"1", "+", "x"}]], 
RowBox[{"x", "<", 
RowBox[{"-", "1"}]}]},
{
RowBox[{"x", "-", 
SuperscriptBox["x", "2"]}], 
RowBox[{
RowBox[{"-", "1"}], "<", "x", "<", "2"}]},
{
RowBox[{
FractionBox["1", "2"], 
RowBox[{"(", 
RowBox[{"1", "-", "x"}], ")"}]}], 
RowBox[{"2", "<=", "x", "<", "3"}]},
{
RowBox[{"Cos", "[", 
RowBox[{"\[Pi]", " ", "x"}], "]"}], 
RowBox[{"3", "<", "x", "<", "4"}]}
},
AllowedDimensions->{2, Automatic},
Editable->True,
GridBoxAlignment->{"Columns" -> {{Left}}, "Rows" -> {{Baseline}}},
GridBoxItemSize->{"Columns" -> {{Automatic}}, "Rows" -> {{1.}}},
GridBoxSpacings->{"Columns" -> {
Offset[
            0.27999999999999997`], {
Offset[0.84]}, 
Offset[0.27999999999999997`]}, "Rows" -> {
Offset[0.2], {
Offset[0.4]}, 
Offset[0.2]}},
Selectable->True]}
},
GridBoxAlignment->{"Columns" -> {{Left}}, "Rows" -> {{Baseline}}},
GridBoxItemSize->{"Columns" -> {{Automatic}}, "Rows" -> {{1.}}},
GridBoxSpacings->{"Columns" -> {
Offset[
         0.27999999999999997`], {
Offset[0.35]}, 
Offset[0.27999999999999997`]}, "Rows" -> {
Offset[0.2], {
Offset[0.4]}, 
Offset[0.2]}}],
"Piecewise",
DeleteWithContents->True,
Editable->False,
SelectWithContents->True,
Selectable->False,
StripWrapperBoxes->True]\)
ResourceFunction["EnhancedPlot"][f[x], {x, -4, 4}, "FindExceptions" -> True, "FindAsymptotes" -> True]
Out[17]=

An example from the resource function FunctionDiscontinuities:

In[18]:=
f[x_] := (-12 - x + x^2)/(8 + 2 x - 5 x^2 + x^3);
ResourceFunction["FunctionDiscontinuities"][f[x], x, "Properties"]
Out[19]=

Plot the result using the Plot command and the option ExclusionsStyle:

In[20]:=
Plot[f[x], {x, -5, 5}, ExclusionsStyle -> {{GrayLevel[.6], Dashed}, {PointSize -> 0.02}}]
Out[20]=

Use EnhancedPlot to obtain a much better plot:

In[21]:=
ResourceFunction["EnhancedPlot"][f[x], {x, -5, 5}, "FindExceptions" -> True]
Out[21]=

It is not necessary to call on the resource function Asymptotes to find the vertical asymptotes of the following function since they are among the discontinuities found by the resource function FunctionDiscontinuities:

In[22]:=
ResourceFunction["EnhancedPlot"][Tan[x], {x, -2 \[Pi], 2 \[Pi]}, "FindExceptions" -> True]
Out[22]=

Plot a function with asymptotes and a removable discontinuity:

In[23]:=
f[x_] := (x^2 - 9)/(x - 3) Sin[2 x] + Tan[x] - 9
ResourceFunction["EnhancedPlot"][f[x], {x, 0, 2 \[Pi]}, "FindExceptions" -> True]
Out[24]=
In[25]:=
ResourceFunction["FunctionDiscontinuities"][f[x], x, "Properties"]
Out[25]=

Remove the singularity by appropriately defining the function at x=3 so that f(3)=limn3f(x):

In[26]:=
Limit[(x^2 - 9)/(x - 3) Sin[2 x] + Tan[x] - 9, x -> 3]
Out[26]=
In[27]:=
f[x_] := \!\(\*
TagBox[GridBox[{
{"\[Piecewise]", GridBox[{
{
RowBox[{
RowBox[{
FractionBox[
RowBox[{
SuperscriptBox["x", "2"], "-", "9"}], 
RowBox[{"x", "-", "3"}]], 
RowBox[{"Sin", "[", 
RowBox[{"2", "x"}], "]"}]}], "+", 
RowBox[{"Tan", "[", "x", "]"}], "-", "9"}], 
RowBox[{"x", "!=", "3"}]},
{
RowBox[{
RowBox[{"-", "9"}], "+", 
RowBox[{"6", " ", 
RowBox[{"Sin", "[", "6", "]"}]}], "+", 
RowBox[{"Tan", "[", "3", "]"}]}], 
RowBox[{"x", "==", "3"}]}
},
AllowedDimensions->{2, Automatic},
Editable->True,
GridBoxAlignment->{"Columns" -> {{Left}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
GridBoxItemSize->{"Columns" -> {{Automatic}}, "ColumnsIndexed" -> {}, "Rows" -> {{1.}}, "RowsIndexed" -> {}},
GridBoxSpacings->{"Columns" -> {
Offset[
            0.27999999999999997`], {
Offset[0.84]}, 
Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
Offset[0.2], {
Offset[0.4]}, 
Offset[0.2]}, "RowsIndexed" -> {}},
Selectable->True]}
},
GridBoxAlignment->{"Columns" -> {{Left}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
GridBoxItemSize->{"Columns" -> {{Automatic}}, "ColumnsIndexed" -> {}, "Rows" -> {{1.}}, "RowsIndexed" -> {}},
GridBoxSpacings->{"Columns" -> {
Offset[
         0.27999999999999997`], {
Offset[0.35]}, 
Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
Offset[0.2], {
Offset[0.4]}, 
Offset[0.2]}, "RowsIndexed" -> {}}],
"Piecewise",
DeleteWithContents->True,
Editable->False,
SelectWithContents->True,
Selectable->False,
StripWrapperBoxes->True]\)
ResourceFunction["EnhancedPlot"][f[x], {x, 0, 2 \[Pi]}, "FindExceptions" -> True]
Out[28]=

Explicitly list the jump point and add the asymptotes manually:

In[29]:=
f[x_] := \!\(\*
TagBox[GridBox[{
{"\[Piecewise]", GridBox[{
{
RowBox[{
RowBox[{
FractionBox[
RowBox[{
SuperscriptBox["x", "2"], "-", "9"}], 
RowBox[{"x", "-", "3"}]], 
RowBox[{"Sin", "[", 
RowBox[{"2", "x"}], "]"}]}], "+", 
RowBox[{"Tan", "[", "x", "]"}], "-", "9"}], 
RowBox[{"x", "!=", "3"}]},
{
RowBox[{
RowBox[{"-", "9"}], "+", 
RowBox[{"6", " ", 
RowBox[{"Sin", "[", "6", "]"}]}], "+", 
RowBox[{"Tan", "[", "3", "]"}]}], 
RowBox[{"x", "==", "3"}]}
},
AllowedDimensions->{2, Automatic},
Editable->True,
GridBoxAlignment->{"Columns" -> {{Left}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
GridBoxItemSize->{"Columns" -> {{Automatic}}, "ColumnsIndexed" -> {}, "Rows" -> {{1.}}, "RowsIndexed" -> {}},
GridBoxSpacings->{"Columns" -> {
Offset[
            0.27999999999999997`], {
Offset[0.84]}, 
Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
Offset[0.2], {
Offset[0.4]}, 
Offset[0.2]}, "RowsIndexed" -> {}},
Selectable->True]}
},
GridBoxAlignment->{"Columns" -> {{Left}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
GridBoxItemSize->{"Columns" -> {{Automatic}}, "ColumnsIndexed" -> {}, "Rows" -> {{1.}}, "RowsIndexed" -> {}},
GridBoxSpacings->{"Columns" -> {
Offset[
         0.27999999999999997`], {
Offset[0.35]}, 
Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
Offset[0.2], {
Offset[0.4]}, 
Offset[0.2]}, "RowsIndexed" -> {}}],
"Piecewise",
DeleteWithContents->True,
Editable->False,
SelectWithContents->True,
Selectable->False,
StripWrapperBoxes->True]\)
ResourceFunction["EnhancedPlot"][f[x], {x, 0, 2 \[Pi]}, "Exception" -> 3, "Asymptote" -> {\[Pi]/2, (3 \[Pi])/2}]
Out[30]=

Plot a function with a jump discontinuity:

In[31]:=
ResourceFunction["EnhancedPlot"][HeavisideTheta[x], {x, -5, 5}, "FindExceptions" -> True]
Out[31]=

A function with an odd root over a domain consisting of two disjoint intervals with one interval containing negative numbers. Plot the function and its derivative:

In[32]:=

ResourceFunction["EnhancedPlot"][{\!\(\*
TagBox[GridBox[{
{"\[Piecewise]", GridBox[{
{
FractionBox[
SuperscriptBox["x", 
RowBox[{"1", "/", "3"}]], 
RowBox[{"1", "+", 
SuperscriptBox["x", "2"]}]], 
RowBox[{"x", "<=", "1"}]},
{
FractionBox["1", 
SuperscriptBox[
RowBox[{"(", 
RowBox[{"1", "-", "x"}], ")"}], "2"]], 
RowBox[{"x", ">", "3"}]}
},
AllowedDimensions->{2, Automatic},
Editable->True,
GridBoxAlignment->{"Columns" -> {{Left}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
GridBoxItemSize->{"Columns" -> {{Automatic}}, "ColumnsIndexed" -> {}, "Rows" -> {{1.}}, "RowsIndexed" -> {}},
GridBoxSpacings->{"Columns" -> {
Offset[
             0.27999999999999997`], {
Offset[0.84]}, 
Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
Offset[0.2], {
Offset[0.4]}, 
Offset[0.2]}, "RowsIndexed" -> {}},
Selectable->True]}
},
GridBoxAlignment->{"Columns" -> {{Left}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
GridBoxItemSize->{"Columns" -> {{Automatic}}, "ColumnsIndexed" -> {}, "Rows" -> {{1.}}, "RowsIndexed" -> {}},
GridBoxSpacings->{"Columns" -> {
Offset[
          0.27999999999999997`], {
Offset[0.35]}, 
Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
Offset[0.2], {
Offset[0.4]}, 
Offset[0.2]}, "RowsIndexed" -> {}}],
"Piecewise",
DeleteWithContents->True,
Editable->False,
SelectWithContents->True,
Selectable->False,
StripWrapperBoxes->True]\) , \!\(\*
TagBox[GridBox[{
{"\[Piecewise]", GridBox[{
{
RowBox[{
RowBox[{"-", 
FractionBox[
RowBox[{"2", " ", 
SuperscriptBox["x", 
RowBox[{"4", "/", "3"}]]}], 
SuperscriptBox[
RowBox[{"(", 
RowBox[{"1", "+", 
SuperscriptBox["x", "2"]}], ")"}], "2"]]}], "+", 
FractionBox["1", 
RowBox[{"3", " ", 
SuperscriptBox["x", 
RowBox[{"2", "/", "3"}]], " ", 
RowBox[{"(", 
RowBox[{"1", "+", 
SuperscriptBox["x", "2"]}], ")"}]}]]}], 
RowBox[{"x", "<", "1"}]},
{
RowBox[{"-", 
FractionBox["2", 
SuperscriptBox[
RowBox[{"(", 
RowBox[{
RowBox[{"-", "1"}], "+", "x"}], ")"}], "3"]]}], 
RowBox[{"x", ">", "3"}]}
},
AllowedDimensions->{2, Automatic},
Editable->True,
GridBoxAlignment->{"Columns" -> {{Left}}, "Rows" -> {{Baseline}}},
GridBoxItemSize->{"Columns" -> {{Automatic}}, "Rows" -> {{1.}}},
GridBoxSpacings->{"Columns" -> {
Offset[
             0.27999999999999997`], {
Offset[0.84]}, 
Offset[0.27999999999999997`]}, "Rows" -> {
Offset[0.2], {
Offset[0.4]}, 
Offset[0.2]}},
Selectable->True]}
},
GridBoxAlignment->{"Columns" -> {{Left}}, "Rows" -> {{Baseline}}},
GridBoxItemSize->{"Columns" -> {{Automatic}}, "Rows" -> {{1.}}},
GridBoxSpacings->{"Columns" -> {
Offset[
          0.27999999999999997`], {
Offset[0.35]}, 
Offset[0.27999999999999997`]}, "Rows" -> {
Offset[0.2], {
Offset[0.4]}, 
Offset[0.2]}}],
"Piecewise",
DeleteWithContents->True,
Editable->False,
SelectWithContents->True,
Selectable->False,
StripWrapperBoxes->True]\)}, {x, -5, 5}, "FindExceptions" -> True, PlotRange -> {-1, 1}]
Out[32]=

Options (17) 

Asymptote and AsymptoteStyle (1) 

Plot a function with two vertical asymptotes and apply a style to the asymptotes:

In[33]:=
ResourceFunction["EnhancedPlot"][Tan[x], {x, -\[Pi], \[Pi]}, "Asymptote" -> {-(\[Pi]/2), \[Pi]/2}, "AsymptoteStyle" -> {{Dashed, Red}}]
Out[33]=

DrawPoint and DrawPointStyle (2) 

Plot a curve with a removable discontinuity and two points drawn off the curve:

In[34]:=
f[x_] := \!\(\*
TagBox[GridBox[{
{"\[Piecewise]", GridBox[{
{
FractionBox[
RowBox[{"Sin", "[", "x", "]"}], "x"], 
RowBox[{"x", "!=", "0"}]},
{".5", 
RowBox[{"x", "==", "0"}]}
},
AllowedDimensions->{2, Automatic},
Editable->True,
GridBoxAlignment->{"Columns" -> {{Left}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
GridBoxItemSize->{"Columns" -> {{Automatic}}, "ColumnsIndexed" -> {}, "Rows" -> {{1.}}, "RowsIndexed" -> {}},
GridBoxSpacings->{"Columns" -> {
Offset[
            0.27999999999999997`], {
Offset[0.84]}, 
Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
Offset[0.2], {
Offset[0.4]}, 
Offset[0.2]}, "RowsIndexed" -> {}},
Selectable->True]}
},
GridBoxAlignment->{"Columns" -> {{Left}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
GridBoxItemSize->{"Columns" -> {{Automatic}}, "ColumnsIndexed" -> {}, "Rows" -> {{1.}}, "RowsIndexed" -> {}},
GridBoxSpacings->{"Columns" -> {
Offset[
         0.27999999999999997`], {
Offset[0.35]}, 
Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
Offset[0.2], {
Offset[0.4]}, 
Offset[0.2]}, "RowsIndexed" -> {}}],
"Piecewise",
DeleteWithContents->True,
Editable->False,
SelectWithContents->True,
Selectable->False]\)
ResourceFunction["EnhancedPlot"][f[x], {x, -\[Pi], \[Pi]}, "Exception" -> 0, "DrawPoint" -> {{-1, 1/4}, {3, 3/4}}, "DrawPointStyle" -> {Red, AbsolutePointSize[15]}, AxesOrigin -> {0, 0}]
Out[35]=

Plot a curve with a removable discontinuity and several points drawn on the curve:

In[36]:=
f[x_] := Sin[x]
ResourceFunction["EnhancedPlot"][f[x], {x, -\[Pi], \[Pi]}, "Exception" -> 0, "DrawPoint" -> Range[-3, 3], "DrawPointStyle" -> {Red, AbsolutePointSize[12]}]
Out[37]=

Exception (1) 

Create plot with several exceptions; a removable discontinuity (at x=-1/2), a jump discontinuity (at x=-1) and an infinite discontinuity (at x=1):

In[38]:=
Clear[f]
f[x_] := \!\(\*
TagBox[GridBox[{
{"\[Piecewise]", GridBox[{
{
FractionBox["1", 
SuperscriptBox["x", "2"]], 
RowBox[{"x", "<=", 
RowBox[{"-", "1"}]}]},
{
RowBox[{
FractionBox[
RowBox[{"Sin", "[", 
RowBox[{"x", "+", 
RowBox[{"1", "/", "2"}]}], "]"}], 
RowBox[{"x", "+", 
RowBox[{"1", "/", "2"}]}]], "+", 
FractionBox["1", 
RowBox[{"x", "-", "1"}]]}], 
RowBox[{
RowBox[{"-", "1"}], "<", "x", "<", "1"}]},
{
FractionBox["1", 
RowBox[{
SuperscriptBox["x", "2"], "-", "1"}]], 
RowBox[{"x", ">=", "1"}]}
},
AllowedDimensions->{2, Automatic},
Editable->True,
GridBoxAlignment->{"Columns" -> {{Left}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
GridBoxItemSize->{"Columns" -> {{Automatic}}, "ColumnsIndexed" -> {}, "Rows" -> {{1.}}, "RowsIndexed" -> {}},
GridBoxSpacings->{"Columns" -> {
Offset[
            0.27999999999999997`], {
Offset[0.84]}, 
Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
Offset[0.2], {
Offset[0.4]}, 
Offset[0.2]}, "RowsIndexed" -> {}},
Selectable->True]}
},
GridBoxAlignment->{"Columns" -> {{Left}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
GridBoxItemSize->{"Columns" -> {{Automatic}}, "ColumnsIndexed" -> {}, "Rows" -> {{1.}}, "RowsIndexed" -> {}},
GridBoxSpacings->{"Columns" -> {
Offset[
         0.27999999999999997`], {
Offset[0.35]}, 
Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
Offset[0.2], {
Offset[0.4]}, 
Offset[0.2]}, "RowsIndexed" -> {}}],
"Piecewise",
DeleteWithContents->True,
Editable->False,
SelectWithContents->True,
Selectable->False,
StripWrapperBoxes->True]\)
ResourceFunction["EnhancedPlot"][f[x], {x, -2, 2}, "Exception" -> {-1, -1/2}, "Asymptote" -> 1]
Out[39]=

FindAsymptotes (2) 

Setting "FindAsymptotes"True uses the resource function Asymptotes to find the asymptotes (one vertical and one oblique) of the following function:

In[40]:=
ResourceFunction["EnhancedPlot"][(2 x^2 + 6 x + 7)/(
 x + 1), {x, -4, 4}, "FindAsymptotes" -> True]
Out[40]=

Plot a function with asymptotes (vertical and other):

In[41]:=
ResourceFunction["EnhancedPlot"][(
 ArcTan[x] + x^5)/x^2, {x, -\[Pi], \[Pi]}, "FindAsymptotes" -> True]
Out[41]=

FindExceptions (3) 

Setting "FindExceptions"True uses the resource function FunctionDiscontinuities to find the discontinuities:

In[42]:=
Clear[f]
f[x_] := \!\(\*
TagBox[GridBox[{
{"\[Piecewise]", GridBox[{
{
FractionBox["1", 
SuperscriptBox["x", "2"]], 
RowBox[{"x", "<=", 
RowBox[{"-", "1"}]}]},
{
RowBox[{
FractionBox[
RowBox[{"Sin", "[", 
RowBox[{"x", "+", 
RowBox[{"1", "/", "2"}]}], "]"}], 
RowBox[{"x", "+", 
RowBox[{"1", "/", "2"}]}]], "+", 
FractionBox["1", 
RowBox[{"x", "-", "1"}]]}], 
RowBox[{
RowBox[{"-", "1"}], "<", "x", "<", "1"}]},
{
FractionBox["1", 
RowBox[{
SuperscriptBox["x", "2"], "-", "1"}]], 
RowBox[{"x", ">=", "1"}]}
},
AllowedDimensions->{2, Automatic},
Editable->True,
GridBoxAlignment->{"Columns" -> {{Left}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
GridBoxItemSize->{"Columns" -> {{Automatic}}, "ColumnsIndexed" -> {}, "Rows" -> {{1.}}, "RowsIndexed" -> {}},
GridBoxSpacings->{"Columns" -> {
Offset[
            0.27999999999999997`], {
Offset[0.84]}, 
Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
Offset[0.2], {
Offset[0.4]}, 
Offset[0.2]}, "RowsIndexed" -> {}},
Selectable->True]}
},
GridBoxAlignment->{"Columns" -> {{Left}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
GridBoxItemSize->{"Columns" -> {{Automatic}}, "ColumnsIndexed" -> {}, "Rows" -> {{1.}}, "RowsIndexed" -> {}},
GridBoxSpacings->{"Columns" -> {
Offset[
         0.27999999999999997`], {
Offset[0.35]}, 
Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
Offset[0.2], {
Offset[0.4]}, 
Offset[0.2]}, "RowsIndexed" -> {}}],
"Piecewise",
DeleteWithContents->True,
Editable->False,
SelectWithContents->True,
Selectable->False,
StripWrapperBoxes->True]\)
ResourceFunction["EnhancedPlot"][f[x], {x, -2, 2}, "FindExceptions" -> True, "Asymptote" -> 1]
Out[43]=

Plot two functions:

In[44]:=
f[x_] := (-12 - x + x^2)/(8 + 2 x - 5 x^2 + x^3);
ResourceFunction[
 "EnhancedPlot"][{f[x], (x - 1)/((x - 1) (x^2 - x - 2))}, {x, -6, 6}, "FindExceptions" -> True, "FindAsymptotes" -> True, PlotRange -> 5]
Out[45]=

If a point is listed as an exception but isn’t an exception, then a solid point is plotted on the graph:

In[46]:=
ResourceFunction[
 "EnhancedPlot"][((x + 1) (x - 2))/(x^2 - x - 2) Sin[x], {x, -6, 6}, "FindExceptions" -> True, "Exception" -> {4}]
Out[46]=

HorizontalAsymptote and HorizontalAsymptoteStyle (1) 

Plot a function with its horizontal asymptote:

In[47]:=
ResourceFunction["EnhancedPlot"][1/(x - 2)^2 + 3, {x, 0, 4}, "Asymptote" -> {2}, "HorizontalAsymptote" -> 3, "HorizontalAsymptoteStyle" -> {{Green, Dashing[Large]}}, AxesOrigin -> {0, 0}]
Out[47]=
In[48]:=
ResourceFunction["EnhancedPlot"][1/(x - 2)^2 + 3, {x, 0, 4}, "FindAsymptotes" -> True, "HorizontalAsymptoteStyle" -> {{Green, Dashing[Large]}}, AxesOrigin -> {0, 0}]
Out[48]=

PointStyle (1) 

Make the points bigger:

In[49]:=
Clear[f]
f[x_] := \!\(\*
TagBox[GridBox[{
{"\[Piecewise]", GridBox[{
{
FractionBox["1", 
RowBox[{"1", "+", "x"}]], 
RowBox[{"x", "<", 
RowBox[{"-", "1"}]}]},
{
RowBox[{"x", "-", 
SuperscriptBox["x", "2"]}], 
RowBox[{
RowBox[{"-", "1"}], "<", "x", "<", "2"}]},
{
RowBox[{
FractionBox["1", "2"], 
RowBox[{"(", 
RowBox[{"1", "-", "x"}], ")"}]}], 
RowBox[{"2", "<=", "x", "<", "3"}]},
{
RowBox[{"Cos", "[", 
RowBox[{"\[Pi]", " ", "x"}], "]"}], 
RowBox[{"3", "<", "x", "<=", "4"}]}
},
AllowedDimensions->{2, Automatic},
Editable->True,
GridBoxAlignment->{"Columns" -> {{Left}}, "Rows" -> {{Baseline}}},
GridBoxItemSize->{"Columns" -> {{Automatic}}, "Rows" -> {{1.}}},
GridBoxSpacings->{"Columns" -> {
Offset[
            0.27999999999999997`], {
Offset[0.84]}, 
Offset[0.27999999999999997`]}, "Rows" -> {
Offset[0.2], {
Offset[0.4]}, 
Offset[0.2]}},
Selectable->True]}
},
GridBoxAlignment->{"Columns" -> {{Left}}, "Rows" -> {{Baseline}}},
GridBoxItemSize->{"Columns" -> {{Automatic}}, "Rows" -> {{1.}}},
GridBoxSpacings->{"Columns" -> {
Offset[
         0.27999999999999997`], {
Offset[0.35]}, 
Offset[0.27999999999999997`]}, "Rows" -> {
Offset[0.2], {
Offset[0.4]}, 
Offset[0.2]}}],
"Piecewise",
DeleteWithContents->True,
Editable->False,
SelectWithContents->True,
Selectable->False,
StripWrapperBoxes->True]\)
ResourceFunction["EnhancedPlot"][f[x], {x, -4, 4}, "FindExceptions" -> True, "HorizontalAsymptote" -> 0, "PointStyle" -> AbsolutePointSize[12]]
Out[50]=
In[51]:=
Clear[f]
f[x_] := \!\(\*
TagBox[GridBox[{
{"\[Piecewise]", GridBox[{
{
FractionBox["1", 
RowBox[{"1", "+", "x"}]], 
RowBox[{"x", "<", 
RowBox[{"-", "1"}]}]},
{
RowBox[{"x", "-", 
SuperscriptBox["x", "2"]}], 
RowBox[{
RowBox[{"-", "1"}], "<", "x", "<", "2"}]},
{
RowBox[{
FractionBox["1", "2"], 
RowBox[{"(", 
RowBox[{"1", "-", "x"}], ")"}]}], 
RowBox[{"2", "<=", "x", "<", "3"}]},
{
RowBox[{"Cos", "[", 
RowBox[{"\[Pi]", " ", "x"}], "]"}], 
RowBox[{"3", "<", "x", "<=", "4"}]}
},
AllowedDimensions->{2, Automatic},
Editable->True,
GridBoxAlignment->{"Columns" -> {{Left}}, "Rows" -> {{Baseline}}},
GridBoxItemSize->{"Columns" -> {{Automatic}}, "Rows" -> {{1.}}},
GridBoxSpacings->{"Columns" -> {
Offset[
            0.27999999999999997`], {
Offset[0.84]}, 
Offset[0.27999999999999997`]}, "Rows" -> {
Offset[0.2], {
Offset[0.4]}, 
Offset[0.2]}},
Selectable->True]}
},
GridBoxAlignment->{"Columns" -> {{Left}}, "Rows" -> {{Baseline}}},
GridBoxItemSize->{"Columns" -> {{Automatic}}, "Rows" -> {{1.}}},
GridBoxSpacings->{"Columns" -> {
Offset[
         0.27999999999999997`], {
Offset[0.35]}, 
Offset[0.27999999999999997`]}, "Rows" -> {
Offset[0.2], {
Offset[0.4]}, 
Offset[0.2]}}],
"Piecewise",
DeleteWithContents->True,
Editable->False,
SelectWithContents->True,
Selectable->False,
StripWrapperBoxes->True]\)
ResourceFunction[
 "EnhancedPlot"][{f[x], Sin[x - 1]/(x - 1)}, {x, -4, 4}, "FindExceptions" -> True, "HorizontalAsymptote" -> 0, "DrawPoint" -> {{0, 1/2}}, "DrawPointStyle" -> Purple]
Out[52]=

PowerBehavior (1) 

By default, the Wolfram Language returns the principal root of a number. If the number is real and negative and the root is odd, then the principal root is an imaginary number. Setting "PowerBehavior" to Real (the default) will force EnhancedPlot to plot the positive root:

In[53]:=
ResourceFunction["EnhancedPlot"][Sin[x^(1/3)], {x, -2, 2}]
Out[53]=

ZeroToNull (5) 

By default, the Wolfram Language does not produce a correct plot of a piecewise function whose domain consists of disjoint intervals. The reason is that it uses 0 as the default value if none of the conditions apply:

In[54]:=
Clear[f]
f[x_] := \!\(\*
TagBox[GridBox[{
{"\[Piecewise]", GridBox[{
{
FractionBox["1", 
RowBox[{"1", "+", 
SuperscriptBox["x", "4"]}]], 
RowBox[{"x", "<", "1"}]},
{
FractionBox["1", 
SuperscriptBox[
RowBox[{"(", 
RowBox[{"1", "-", "x"}], ")"}], "2"]], 
RowBox[{"x", ">", "3"}]}
},
AllowedDimensions->{2, Automatic},
Editable->True,
GridBoxAlignment->{"Columns" -> {{Left}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
GridBoxItemSize->{"Columns" -> {{Automatic}}, "ColumnsIndexed" -> {}, "Rows" -> {{1.}}, "RowsIndexed" -> {}},
GridBoxSpacings->{"Columns" -> {
Offset[
            0.27999999999999997`], {
Offset[0.84]}, 
Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
Offset[0.2], {
Offset[0.4]}, 
Offset[0.2]}, "RowsIndexed" -> {}},
Selectable->True]}
},
GridBoxAlignment->{"Columns" -> {{Left}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
GridBoxItemSize->{"Columns" -> {{Automatic}}, "ColumnsIndexed" -> {}, "Rows" -> {{1.}}, "RowsIndexed" -> {}},
GridBoxSpacings->{"Columns" -> {
Offset[
         0.27999999999999997`], {
Offset[0.35]}, 
Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
Offset[0.2], {
Offset[0.4]}, 
Offset[0.2]}, "RowsIndexed" -> {}}],
"Piecewise",
DeleteWithContents->True,
Editable->False,
SelectWithContents->True,
Selectable->False,
StripWrapperBoxes->True]\)
Plot[f[x], {x, -5, 5}, PlotStyle -> Purple]
Out[55]=

A correct plot is obtained by manually setting the default value of the Piecewise to Null:

In[56]:=
Clear[f]
f[x_] := \!\(\*
TagBox[GridBox[{
{"\[Piecewise]", GridBox[{
{
FractionBox["1", 
RowBox[{"1", "+", 
SuperscriptBox["x", "4"]}]], 
RowBox[{"x", "<", "1"}]},
{
FractionBox["1", 
SuperscriptBox[
RowBox[{"(", 
RowBox[{"1", "-", "x"}], ")"}], "2"]], 
RowBox[{"x", ">", "3"}]},
{"Null", "True"}
},
AllowedDimensions->{2, Automatic},
Editable->True,
GridBoxAlignment->{"Columns" -> {{Left}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
GridBoxItemSize->{"Columns" -> {{Automatic}}, "ColumnsIndexed" -> {}, "Rows" -> {{1.}}, "RowsIndexed" -> {}},
GridBoxSpacings->{"Columns" -> {
Offset[
            0.27999999999999997`], {
Offset[0.84]}, 
Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
Offset[0.2], {
Offset[0.4]}, 
Offset[0.2]}, "RowsIndexed" -> {}},
Selectable->True]}
},
GridBoxAlignment->{"Columns" -> {{Left}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
GridBoxItemSize->{"Columns" -> {{Automatic}}, "ColumnsIndexed" -> {}, "Rows" -> {{1.}}, "RowsIndexed" -> {}},
GridBoxSpacings->{"Columns" -> {
Offset[
         0.27999999999999997`], {
Offset[0.35]}, 
Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
Offset[0.2], {
Offset[0.4]}, 
Offset[0.2]}, "RowsIndexed" -> {}}],
"Piecewise",
DeleteWithContents->True,
Editable->False,
SelectWithContents->True,
Selectable->False,
StripWrapperBoxes->True]\)
Plot[f[x], {x, -5, 5}, PlotStyle -> Purple]
Out[57]=

EnhancedPlot automatically sets the default value of Piecewise to Null:

In[58]:=
Clear[f]
f[x_] := \!\(\*
TagBox[GridBox[{
{"\[Piecewise]", GridBox[{
{
FractionBox["1", 
RowBox[{"1", "+", 
SuperscriptBox["x", "4"]}]], 
RowBox[{"x", "<=", "1"}]},
{
FractionBox["1", 
SuperscriptBox[
RowBox[{"(", 
RowBox[{"1", "-", "x"}], ")"}], "2"]], 
RowBox[{"x", ">=", "3"}]}
},
AllowedDimensions->{2, Automatic},
Editable->True,
GridBoxAlignment->{"Columns" -> {{Left}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
GridBoxItemSize->{"Columns" -> {{Automatic}}, "ColumnsIndexed" -> {}, "Rows" -> {{1.}}, "RowsIndexed" -> {}},
GridBoxSpacings->{"Columns" -> {
Offset[
            0.27999999999999997`], {
Offset[0.84]}, 
Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
Offset[0.2], {
Offset[0.4]}, 
Offset[0.2]}, "RowsIndexed" -> {}},
Selectable->True]}
},
GridBoxAlignment->{"Columns" -> {{Left}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
GridBoxItemSize->{"Columns" -> {{Automatic}}, "ColumnsIndexed" -> {}, "Rows" -> {{1.}}, "RowsIndexed" -> {}},
GridBoxSpacings->{"Columns" -> {
Offset[
         0.27999999999999997`], {
Offset[0.35]}, 
Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
Offset[0.2], {
Offset[0.4]}, 
Offset[0.2]}, "RowsIndexed" -> {}}],
"Piecewise",
DeleteWithContents->True,
Editable->False,
SelectWithContents->True,
Selectable->False,
StripWrapperBoxes->True]\)
ResourceFunction["EnhancedPlot"][f[x], {x, -5, 5}, PlotStyle -> Purple]
Out[59]=

Return default Plot behavior by setting the option "ZeroToNull" to False:

In[60]:=
Clear[f]
f[x_] := \!\(\*
TagBox[GridBox[{
{"\[Piecewise]", GridBox[{
{
FractionBox["1", 
RowBox[{"1", "+", 
SuperscriptBox["x", "4"]}]], 
RowBox[{"x", "<=", "1"}]},
{
FractionBox["1", 
SuperscriptBox[
RowBox[{"(", 
RowBox[{"1", "-", "x"}], ")"}], "2"]], 
RowBox[{"x", ">", "3"}]}
},
AllowedDimensions->{2, Automatic},
Editable->True,
GridBoxAlignment->{"Columns" -> {{Left}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
GridBoxItemSize->{"Columns" -> {{Automatic}}, "ColumnsIndexed" -> {}, "Rows" -> {{1.}}, "RowsIndexed" -> {}},
GridBoxSpacings->{"Columns" -> {
Offset[
            0.27999999999999997`], {
Offset[0.84]}, 
Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
Offset[0.2], {
Offset[0.4]}, 
Offset[0.2]}, "RowsIndexed" -> {}},
Selectable->True]}
},
GridBoxAlignment->{"Columns" -> {{Left}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
GridBoxItemSize->{"Columns" -> {{Automatic}}, "ColumnsIndexed" -> {}, "Rows" -> {{1.}}, "RowsIndexed" -> {}},
GridBoxSpacings->{"Columns" -> {
Offset[
         0.27999999999999997`], {
Offset[0.35]}, 
Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
Offset[0.2], {
Offset[0.4]}, 
Offset[0.2]}, "RowsIndexed" -> {}}],
"Piecewise",
DeleteWithContents->True,
Editable->False,
SelectWithContents->True,
Selectable->False,
StripWrapperBoxes->True]\)
ResourceFunction["EnhancedPlot"][f[x], {x, -5, 5}, PlotStyle -> Purple, "ZeroToNull" -> False]
Out[61]=

Note that with the option "ZeroToNull" set to False, "FindExceptions" will list the break points as jump discontinuities:

In[62]:=
ResourceFunction["EnhancedPlot"][f[x], {x, -5, 5}, "FindExceptions" -> True, "ZeroToNull" -> False]
Out[62]=

Possible Issues (4) 

The resource function Asymptotes can be very slow:

In[63]:=
Clear[f]
f[x_] := \!\(\*
TagBox[GridBox[{
{"\[Piecewise]", GridBox[{
{
RowBox[{
FractionBox["1", 
RowBox[{"1", "+", 
SuperscriptBox["x", "2"]}]], "+", "x"}], 
RowBox[{"x", "<", 
RowBox[{"-", "1"}]}]},
{
RowBox[{
SuperscriptBox["x", 
RowBox[{"5", "/", "3"}]], "-", "1"}], 
RowBox[{
RowBox[{"-", "1"}], "<=", "x", "<", "2"}]},
{
RowBox[{"1", "/", "x"}], 
RowBox[{"2", "<", "x", "<", "3"}]},
{
RowBox[{"Cos", "[", "x", "]"}], 
RowBox[{"3", "<", "x", "<", "4"}]}
},
AllowedDimensions->{2, Automatic},
Editable->True,
GridBoxAlignment->{"Columns" -> {{Left}}, "Rows" -> {{Baseline}}},
GridBoxItemSize->{"Columns" -> {{Automatic}}, "Rows" -> {{1.}}},
GridBoxSpacings->{"Columns" -> {
Offset[
            0.27999999999999997`], {
Offset[0.84]}, 
Offset[0.27999999999999997`]}, "Rows" -> {
Offset[0.2], {
Offset[0.4]}, 
Offset[0.2]}},
Selectable->True]}
},
GridBoxAlignment->{"Columns" -> {{Left}}, "Rows" -> {{Baseline}}},
GridBoxItemSize->{"Columns" -> {{Automatic}}, "Rows" -> {{1.}}},
GridBoxSpacings->{"Columns" -> {
Offset[
         0.27999999999999997`], {
Offset[0.35]}, 
Offset[0.27999999999999997`]}, "Rows" -> {
Offset[0.2], {
Offset[0.4]}, 
Offset[0.2]}}],
"Piecewise",
DeleteWithContents->True,
Editable->False,
SelectWithContents->True,
Selectable->False,
StripWrapperBoxes->True]\)
ResourceFunction["Asymptotes"][f[x], x, y]
Out[64]=

This contributes a significant amount of time to EnhancedPlot if the setting "FindAsymptotes"True is used:

In[65]:=
Clear[f]
f[x_] := \!\(\*
TagBox[GridBox[{
{"\[Piecewise]", GridBox[{
{
RowBox[{
FractionBox["1", 
RowBox[{"1", "+", 
SuperscriptBox["x", "2"]}]], "+", "x"}], 
RowBox[{"x", "<", "0"}]},
{
RowBox[{
SuperscriptBox["x", 
RowBox[{"5", "/", "3"}]], "-", "1"}], 
RowBox[{"0", "<=", "x", "<", "2"}]},
{
RowBox[{"1", "/", "x"}], 
RowBox[{"2", "<", "x", "<", "3"}]},
{
RowBox[{"Cos", "[", "x", "]"}], 
RowBox[{"3", "<", "x", "<", "4"}]}
},
AllowedDimensions->{2, Automatic},
Editable->True,
GridBoxAlignment->{"Columns" -> {{Left}}, "Rows" -> {{Baseline}}},
GridBoxItemSize->{"Columns" -> {{Automatic}}, "Rows" -> {{1.}}},
GridBoxSpacings->{"Columns" -> {
Offset[
            0.27999999999999997`], {
Offset[0.84]}, 
Offset[0.27999999999999997`]}, "Rows" -> {
Offset[0.2], {
Offset[0.4]}, 
Offset[0.2]}},
Selectable->True]}
},
GridBoxAlignment->{"Columns" -> {{Left}}, "Rows" -> {{Baseline}}},
GridBoxItemSize->{"Columns" -> {{Automatic}}, "Rows" -> {{1.}}},
GridBoxSpacings->{"Columns" -> {
Offset[
         0.27999999999999997`], {
Offset[0.35]}, 
Offset[0.27999999999999997`]}, "Rows" -> {
Offset[0.2], {
Offset[0.4]}, 
Offset[0.2]}}],
"Piecewise",
DeleteWithContents->True,
Editable->False,
SelectWithContents->True,
Selectable->False,
StripWrapperBoxes->True]\)
ResourceFunction["EnhancedPlot"][f[x], {x, -4, 4}, "FindExceptions" -> True, "FindAsymptotes" -> True]
Out[66]=

On the other hand, "FindExceptions" is very fast:

In[67]:=
Clear[f]
f[x_] := \!\(\*
TagBox[GridBox[{
{"\[Piecewise]", GridBox[{
{
RowBox[{
FractionBox["1", 
RowBox[{"1", "+", 
SuperscriptBox["x", "2"]}]], "+", "x"}], 
RowBox[{"x", "<", "0"}]},
{
RowBox[{
SuperscriptBox["x", 
RowBox[{"5", "/", "3"}]], "-", "1"}], 
RowBox[{"0", "<=", "x", "<", "2"}]},
{
RowBox[{"1", "/", "x"}], 
RowBox[{"2", "<", "x", "<", "3"}]},
{
RowBox[{"Cos", "[", "x", "]"}], 
RowBox[{"3", "<", "x", "<", "4"}]}
},
AllowedDimensions->{2, Automatic},
Editable->True,
GridBoxAlignment->{"Columns" -> {{Left}}, "Rows" -> {{Baseline}}},
GridBoxItemSize->{"Columns" -> {{Automatic}}, "Rows" -> {{1.}}},
GridBoxSpacings->{"Columns" -> {
Offset[
            0.27999999999999997`], {
Offset[0.84]}, 
Offset[0.27999999999999997`]}, "Rows" -> {
Offset[0.2], {
Offset[0.4]}, 
Offset[0.2]}},
Selectable->True]}
},
GridBoxAlignment->{"Columns" -> {{Left}}, "Rows" -> {{Baseline}}},
GridBoxItemSize->{"Columns" -> {{Automatic}}, "Rows" -> {{1.}}},
GridBoxSpacings->{"Columns" -> {
Offset[
         0.27999999999999997`], {
Offset[0.35]}, 
Offset[0.27999999999999997`]}, "Rows" -> {
Offset[0.2], {
Offset[0.4]}, 
Offset[0.2]}}],
"Piecewise",
DeleteWithContents->True,
Editable->False,
SelectWithContents->True,
Selectable->False,
StripWrapperBoxes->True]\)
ResourceFunction["EnhancedPlot"][f[x], {x, -4, 4}, "FindExceptions" -> True]
Out[68]=

The resource function Asymptotes can miss the asymptotes of some functions:

In[69]:=
Clear[f]
f[x_] := \!\(\*
TagBox[GridBox[{
{"\[Piecewise]", GridBox[{
{
FractionBox["1", 
RowBox[{"1", "+", 
RowBox[{"x", " ", 
SuperscriptBox[
RadicalBox["x", "3",
MultilineFunction->None,
SurdForm->True], "2"]}]}]], 
RowBox[{"x", "<", 
RowBox[{"-", "1"}]}]},
{
RowBox[{"Sin", "[", 
RowBox[{"4", " ", "x"}], "]"}], 
RowBox[{
RowBox[{"-", "1"}], "<=", "x", "<", "0"}]},
{"0", 
RowBox[{"x", "==", "0"}]},
{
RowBox[{"Sin", "[", 
RowBox[{"4", " ", "x"}], "]"}], 
RowBox[{"0", "<", "x", "<", 
FractionBox["1", "2"]}]},
{"2", 
RowBox[{
FractionBox["1", "2"], "<=", "x", "<", "1"}]},
{
FractionBox["\[Pi]", "2"], 
RowBox[{"x", "==", "1"}]},
{
FractionBox["1", 
RowBox[{"1", "-", "x"}]], 
RowBox[{"x", ">", "1"}]}
},
AllowedDimensions->{2, Automatic},
Editable->True,
GridBoxAlignment->{"Columns" -> {{Left}}, "Rows" -> {{Baseline}}},
GridBoxItemSize->{"Columns" -> {{Automatic}}, "Rows" -> {{1.}}},
GridBoxSpacings->{"Columns" -> {
Offset[
            0.27999999999999997`], {
Offset[0.84]}, 
Offset[0.27999999999999997`]}, "Rows" -> {
Offset[0.2], {
Offset[0.4]}, 
Offset[0.2]}},
Selectable->True]}
},
GridBoxAlignment->{"Columns" -> {{Left}}, "Rows" -> {{Baseline}}},
GridBoxItemSize->{"Columns" -> {{Automatic}}, "Rows" -> {{1.}}},
GridBoxSpacings->{"Columns" -> {
Offset[
         0.27999999999999997`], {
Offset[0.35]}, 
Offset[0.27999999999999997`]}, "Rows" -> {
Offset[0.2], {
Offset[0.4]}, 
Offset[0.2]}}],
"Piecewise",
DeleteWithContents->True,
Editable->False,
SelectWithContents->True,
Selectable->False,
StripWrapperBoxes->True]\)
ResourceFunction["Asymptotes"][f[x], x, y]
Out[70]=

The resource function FunctionDiscontinuities will find the exceptions:

In[71]:=
Clear[f]
f[x_] := \!\(\*
TagBox[GridBox[{
{"\[Piecewise]", GridBox[{
{
FractionBox["1", 
RowBox[{"1", "+", 
RowBox[{"x", " ", 
SuperscriptBox[
RadicalBox["x", "3",
MultilineFunction->None,
SurdForm->True], "2"]}]}]], 
RowBox[{"x", "<", 
RowBox[{"-", "1"}]}]},
{
RowBox[{"Sin", "[", 
RowBox[{"4", " ", "x"}], "]"}], 
RowBox[{
RowBox[{"-", "1"}], "<=", "x", "<", "0"}]},
{"0", 
RowBox[{"x", "==", "0"}]},
{
RowBox[{"Sin", "[", 
RowBox[{"4", " ", "x"}], "]"}], 
RowBox[{"0", "<", "x", "<", 
FractionBox["1", "2"]}]},
{"2", 
RowBox[{
FractionBox["1", "2"], "<=", "x", "<", "1"}]},
{
FractionBox["\[Pi]", "2"], 
RowBox[{"x", "==", "1"}]},
{
FractionBox["1", 
RowBox[{"1", "-", "x"}]], 
RowBox[{"x", ">", "1"}]}
},
AllowedDimensions->{2, Automatic},
Editable->True,
GridBoxAlignment->{"Columns" -> {{Left}}, "Rows" -> {{Baseline}}},
GridBoxItemSize->{"Columns" -> {{Automatic}}, "Rows" -> {{1.}}},
GridBoxSpacings->{"Columns" -> {
Offset[
            0.27999999999999997`], {
Offset[0.84]}, 
Offset[0.27999999999999997`]}, "Rows" -> {
Offset[0.2], {
Offset[0.4]}, 
Offset[0.2]}},
Selectable->True]}
},
GridBoxAlignment->{"Columns" -> {{Left}}, "Rows" -> {{Baseline}}},
GridBoxItemSize->{"Columns" -> {{Automatic}}, "Rows" -> {{1.}}},
GridBoxSpacings->{"Columns" -> {
Offset[
         0.27999999999999997`], {
Offset[0.35]}, 
Offset[0.27999999999999997`]}, "Rows" -> {
Offset[0.2], {
Offset[0.4]}, 
Offset[0.2]}}],
"Piecewise",
DeleteWithContents->True,
Editable->False,
SelectWithContents->True,
Selectable->False,
StripWrapperBoxes->True]\)
ResourceFunction["EnhancedPlot"][f[x], {x, -2, 2}, "FindExceptions" -> True]
Out[72]=

EnhancedPlot sometimes misses a removable discontinuity:

In[73]:=
ResourceFunction["EnhancedPlot"][x/x Sin[x], {x, -2, 2}, "FindExceptions" -> True]
Out[73]=

However, the discontinuity can be listed manually:

In[74]:=
ResourceFunction["EnhancedPlot"][x/x Sin[x], {x, -2, 2}, "Exception" -> 0]
Out[74]=

When a discontinuity denoted by a filled circle is overlapped by a empty circle, the filled circle is covered by the empty circle. That is, the empty circle is not really empty (see behavior at x=4):

In[75]:=
Clear[g]
g[x_] := \!\(\*
TagBox[GridBox[{
{"\[Piecewise]", GridBox[{
{
FractionBox["1", 
RowBox[{"1", "+", 
RowBox[{"x", " ", 
SuperscriptBox[
RadicalBox["x", "3",
MultilineFunction->None,
SurdForm->True], "2"]}]}]], 
RowBox[{"x", "<", 
RowBox[{"-", "1"}]}]},
{
RadicalBox[
SuperscriptBox["x", "5"], "3",
MultilineFunction->None,
SurdForm->True], 
RowBox[{
RowBox[{"-", "1"}], "<", "x", "<", "2"}]},
{"0", 
RowBox[{"2", "<=", "x", "<", "2.5"}]},
{
RowBox[{"Cos", "[", 
RowBox[{"\[Pi]", " ", "x"}], "]"}], 
RowBox[{"4", "<=", "x", "<", 
RowBox[{"2", "\[Pi]"}]}]}
},
AllowedDimensions->{2, Automatic},
Editable->True,
GridBoxAlignment->{"Columns" -> {{Left}}, "Rows" -> {{Baseline}}},
GridBoxItemSize->{"Columns" -> {{Automatic}}, "Rows" -> {{1.}}},
GridBoxSpacings->{"Columns" -> {
Offset[
            0.27999999999999997`], {
Offset[0.84]}, 
Offset[0.27999999999999997`]}, "Rows" -> {
Offset[0.2], {
Offset[0.4]}, 
Offset[0.2]}},
Selectable->True]}
},
GridBoxAlignment->{"Columns" -> {{Left}}, "Rows" -> {{Baseline}}},
GridBoxItemSize->{"Columns" -> {{Automatic}}, "Rows" -> {{1.}}},
GridBoxSpacings->{"Columns" -> {
Offset[
         0.27999999999999997`], {
Offset[0.35]}, 
Offset[0.27999999999999997`]}, "Rows" -> {
Offset[0.2], {
Offset[0.4]}, 
Offset[0.2]}}],
"Piecewise",
DeleteWithContents->True,
Editable->False,
SelectWithContents->True,
Selectable->False,
StripWrapperBoxes->True]\)
h[x_] := \!\(\*
TagBox[GridBox[{
{"\[Piecewise]", GridBox[{
{"1", 
RowBox[{"x", "<", "4"}]},
{"2", 
RowBox[{"x", ">", "4"}]}
},
AllowedDimensions->{2, Automatic},
Editable->True,
GridBoxAlignment->{"Columns" -> {{Left}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
GridBoxItemSize->{"Columns" -> {{Automatic}}, "ColumnsIndexed" -> {}, "Rows" -> {{1.}}, "RowsIndexed" -> {}},
GridBoxSpacings->{"Columns" -> {
Offset[
            0.27999999999999997`], {
Offset[0.84]}, 
Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
Offset[0.2], {
Offset[0.4]}, 
Offset[0.2]}, "RowsIndexed" -> {}},
Selectable->True]}
},
GridBoxAlignment->{"Columns" -> {{Left}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
GridBoxItemSize->{"Columns" -> {{Automatic}}, "ColumnsIndexed" -> {}, "Rows" -> {{1.}}, "RowsIndexed" -> {}},
GridBoxSpacings->{"Columns" -> {
Offset[
         0.27999999999999997`], {
Offset[0.35]}, 
Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
Offset[0.2], {
Offset[0.4]}, 
Offset[0.2]}, "RowsIndexed" -> {}}],
"Piecewise",
DeleteWithContents->True,
Editable->False,
SelectWithContents->True,
Selectable->False,
StripWrapperBoxes->True]\)
ResourceFunction["EnhancedPlot"][{g[x], h[x]}, {x, -2, 2 \[Pi]}, "FindExceptions" -> True, PlotStyle -> Thick]
Out[76]=

Resource History

Related Resources

License Information