1
$\begingroup$

I am finding a local maximum of a curve and I want to make the plot easier to read. I added a point to where the maximum is but I would also like to:

1) add a tick with text below it where the x value of the maximum is (saying "Xmax" or " X* ")

2) a dotted line from the point down to the x-axis.

Here is a simpler version of the plot I'm making:

maxi = FindMaximum[Cos[x], {x, 4, 8}];
coordin = {x /. maxi[[2]], First[maxi]};
Plot[Cos[x], {x, 0, 4 \[Pi]}, Epilog -> {PointSize[Large], Point[coordin]}]

I have pictures to better explain this but I'm not allowed to post images.

$\endgroup$
  • 1
    $\begingroup$ "I have pictures to better explain this but I'm not allowed to post images." - maybe post a link to your images, and I (or somebody else) will put them in for you. $\endgroup$ – J. M. will be back soon Apr 23 '13 at 15:04
2
$\begingroup$

Is this what you want?

maxi = FindMaximum[Cos[x], {x, 4, 8}];
coordin = {x /. maxi[[2]], First[maxi]};
Plot[Cos[x], {x, 0, 4 \[Pi]}, 
 Epilog -> {PointSize[Large], Point[coordin], Dashed, 
   Line[{coordin, {coordin[[1]], 0}}], Text["X", coordin + {0.5, 0}]}]

enter image description here

$\endgroup$
  • $\begingroup$ :) close! how do you put the "X" below the x axis? $\endgroup$ – LiaChica Apr 23 '13 at 15:26
  • 1
    $\begingroup$ How about change Text["X", coordin + {0.5, 0}] to Text["X", {coordin[[1]], -0.1}]? $\endgroup$ – user0501 Apr 23 '13 at 15:29
  • $\begingroup$ Got it! Thank you! :-) $\endgroup$ – LiaChica Apr 24 '13 at 10:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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