How do I label critical points on the plot of a curve?
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
I want to label the local maxima, local minima, and points of inflection on a plot of a curve. How is this done in Mathematica?
plotting calculus-and-analysis
New contributor
add a comment |Â
up vote
1
down vote
favorite
I want to label the local maxima, local minima, and points of inflection on a plot of a curve. How is this done in Mathematica?
plotting calculus-and-analysis
New contributor
3
Have you tried anything? Do you have an example function?
â J. M. is somewhat okay.â¦
2 hours ago
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I want to label the local maxima, local minima, and points of inflection on a plot of a curve. How is this done in Mathematica?
plotting calculus-and-analysis
New contributor
I want to label the local maxima, local minima, and points of inflection on a plot of a curve. How is this done in Mathematica?
plotting calculus-and-analysis
plotting calculus-and-analysis
New contributor
New contributor
edited 1 hour ago
m_goldberg
82.7k870190
82.7k870190
New contributor
asked 2 hours ago
Saurabh Patel
61
61
New contributor
New contributor
3
Have you tried anything? Do you have an example function?
â J. M. is somewhat okay.â¦
2 hours ago
add a comment |Â
3
Have you tried anything? Do you have an example function?
â J. M. is somewhat okay.â¦
2 hours ago
3
3
Have you tried anything? Do you have an example function?
â J. M. is somewhat okay.â¦
2 hours ago
Have you tried anything? Do you have an example function?
â J. M. is somewhat okay.â¦
2 hours ago
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
3
down vote
One way to produce such labeling as you ask for is to use Callout
. However, Callout
only works in plots and not in graphic directives. This complicates things a little because Epilog
can't be used to show the points. I resort to plotting the curve on one plot and the critical points and their labels on another and then combining the two with Show
.
Here is an example using a cubic polynomial as the curve.
f[x_] := x (x - 1) (x + 1)
pts = #, f[#] & /@ -(1/Sqrt[3]), 0, 1/Sqrt[3] // Nl;
lbls = "max", "inflection", "min";
places = Automatic, Automatic, .63, -.43;
pts
are the critical pointslbls
are their labelsplaces
are where they will be placed. Note that I only override Mathematica's automatic placement for the minimum. I was OK with the placement of the other two points.
With[max = 1,
curve = Plot[f[x], x, -max, max];
points =
ListPlot[MapThread[Callout[#1, #2, #3] &, pts, lbls, places],
PlotRange -> -max, max, Automatic,
PlotStyle -> Red, AbsolutePointSize[8]]];
Show[curve, points, PlotRange -> All]
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
One way to produce such labeling as you ask for is to use Callout
. However, Callout
only works in plots and not in graphic directives. This complicates things a little because Epilog
can't be used to show the points. I resort to plotting the curve on one plot and the critical points and their labels on another and then combining the two with Show
.
Here is an example using a cubic polynomial as the curve.
f[x_] := x (x - 1) (x + 1)
pts = #, f[#] & /@ -(1/Sqrt[3]), 0, 1/Sqrt[3] // Nl;
lbls = "max", "inflection", "min";
places = Automatic, Automatic, .63, -.43;
pts
are the critical pointslbls
are their labelsplaces
are where they will be placed. Note that I only override Mathematica's automatic placement for the minimum. I was OK with the placement of the other two points.
With[max = 1,
curve = Plot[f[x], x, -max, max];
points =
ListPlot[MapThread[Callout[#1, #2, #3] &, pts, lbls, places],
PlotRange -> -max, max, Automatic,
PlotStyle -> Red, AbsolutePointSize[8]]];
Show[curve, points, PlotRange -> All]
add a comment |Â
up vote
3
down vote
One way to produce such labeling as you ask for is to use Callout
. However, Callout
only works in plots and not in graphic directives. This complicates things a little because Epilog
can't be used to show the points. I resort to plotting the curve on one plot and the critical points and their labels on another and then combining the two with Show
.
Here is an example using a cubic polynomial as the curve.
f[x_] := x (x - 1) (x + 1)
pts = #, f[#] & /@ -(1/Sqrt[3]), 0, 1/Sqrt[3] // Nl;
lbls = "max", "inflection", "min";
places = Automatic, Automatic, .63, -.43;
pts
are the critical pointslbls
are their labelsplaces
are where they will be placed. Note that I only override Mathematica's automatic placement for the minimum. I was OK with the placement of the other two points.
With[max = 1,
curve = Plot[f[x], x, -max, max];
points =
ListPlot[MapThread[Callout[#1, #2, #3] &, pts, lbls, places],
PlotRange -> -max, max, Automatic,
PlotStyle -> Red, AbsolutePointSize[8]]];
Show[curve, points, PlotRange -> All]
add a comment |Â
up vote
3
down vote
up vote
3
down vote
One way to produce such labeling as you ask for is to use Callout
. However, Callout
only works in plots and not in graphic directives. This complicates things a little because Epilog
can't be used to show the points. I resort to plotting the curve on one plot and the critical points and their labels on another and then combining the two with Show
.
Here is an example using a cubic polynomial as the curve.
f[x_] := x (x - 1) (x + 1)
pts = #, f[#] & /@ -(1/Sqrt[3]), 0, 1/Sqrt[3] // Nl;
lbls = "max", "inflection", "min";
places = Automatic, Automatic, .63, -.43;
pts
are the critical pointslbls
are their labelsplaces
are where they will be placed. Note that I only override Mathematica's automatic placement for the minimum. I was OK with the placement of the other two points.
With[max = 1,
curve = Plot[f[x], x, -max, max];
points =
ListPlot[MapThread[Callout[#1, #2, #3] &, pts, lbls, places],
PlotRange -> -max, max, Automatic,
PlotStyle -> Red, AbsolutePointSize[8]]];
Show[curve, points, PlotRange -> All]
One way to produce such labeling as you ask for is to use Callout
. However, Callout
only works in plots and not in graphic directives. This complicates things a little because Epilog
can't be used to show the points. I resort to plotting the curve on one plot and the critical points and their labels on another and then combining the two with Show
.
Here is an example using a cubic polynomial as the curve.
f[x_] := x (x - 1) (x + 1)
pts = #, f[#] & /@ -(1/Sqrt[3]), 0, 1/Sqrt[3] // Nl;
lbls = "max", "inflection", "min";
places = Automatic, Automatic, .63, -.43;
pts
are the critical pointslbls
are their labelsplaces
are where they will be placed. Note that I only override Mathematica's automatic placement for the minimum. I was OK with the placement of the other two points.
With[max = 1,
curve = Plot[f[x], x, -max, max];
points =
ListPlot[MapThread[Callout[#1, #2, #3] &, pts, lbls, places],
PlotRange -> -max, max, Automatic,
PlotStyle -> Red, AbsolutePointSize[8]]];
Show[curve, points, PlotRange -> All]
answered 42 mins ago
m_goldberg
82.7k870190
82.7k870190
add a comment |Â
add a comment |Â
Saurabh Patel is a new contributor. Be nice, and check out our Code of Conduct.
Saurabh Patel is a new contributor. Be nice, and check out our Code of Conduct.
Saurabh Patel is a new contributor. Be nice, and check out our Code of Conduct.
Saurabh Patel is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f183510%2fhow-do-i-label-critical-points-on-the-plot-of-a-curve%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
3
Have you tried anything? Do you have an example function?
â J. M. is somewhat okay.â¦
2 hours ago