How do I label critical points on the plot of a curve?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite
1












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?









share









New contributor




Saurabh Patel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.















  • 3




    Have you tried anything? Do you have an example function?
    – J. M. is somewhat okay.♦
    2 hours ago














up vote
1
down vote

favorite
1












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?









share









New contributor




Saurabh Patel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.















  • 3




    Have you tried anything? Do you have an example function?
    – J. M. is somewhat okay.♦
    2 hours ago












up vote
1
down vote

favorite
1









up vote
1
down vote

favorite
1






1





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?









share









New contributor




Saurabh Patel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











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





share









New contributor




Saurabh Patel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.










share









New contributor




Saurabh Patel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








share



share








edited 1 hour ago









m_goldberg

82.7k870190




82.7k870190






New contributor




Saurabh Patel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 2 hours ago









Saurabh Patel

61




61




New contributor




Saurabh Patel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Saurabh Patel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Saurabh Patel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







  • 3




    Have you tried anything? Do you have an example function?
    – J. M. is somewhat okay.♦
    2 hours ago












  • 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










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 points
lbls are their labels
places 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]


plot






share|improve this answer




















    Your Answer




    StackExchange.ifUsing("editor", function ()
    return StackExchange.using("mathjaxEditing", function ()
    StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
    StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
    );
    );
    , "mathjax-editing");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "387"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: false,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );






    Saurabh Patel is a new contributor. Be nice, and check out our Code of Conduct.









     

    draft saved


    draft discarded


















    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






























    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 points
    lbls are their labels
    places 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]


    plot






    share|improve this answer
























      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 points
      lbls are their labels
      places 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]


      plot






      share|improve this answer






















        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 points
        lbls are their labels
        places 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]


        plot






        share|improve this answer












        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 points
        lbls are their labels
        places 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]


        plot







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 42 mins ago









        m_goldberg

        82.7k870190




        82.7k870190




















            Saurabh Patel is a new contributor. Be nice, and check out our Code of Conduct.









             

            draft saved


            draft discarded


















            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.













             


            draft saved


            draft discarded














            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













































































            Comments

            Popular posts from this blog

            What does second last employer means? [closed]

            Installing NextGIS Connect into QGIS 3?

            One-line joke