# Mathematica:how to plot a maximum point in a graph

1. Mar 29, 2012

### shafieza_garl

anyone can help me to plot a point.

Code (Text):
r = Plot[Sin[j], {j, 0, Pi}];
what i am doing is i use FindMaximum first to know the point of maximum.
Code (Text):
FindMaximum[Sin[j], {j, Pi}]
then i manually key in the x,y coordinate from the search.

Code (Text):
onedot = ListPlot[{{1.5707963267948966, 1}},
PlotStyle -> {Hue[0.67], AbsolutePointSize[7]}];
Show[r, onedot]
is there any way i can plot the maximum point without key-in manually using the findmaximum point.
thanks

2. Mar 29, 2012

### chiro

One suggestion I have is to create a test function with {-1,0} {0,maxpoint} and {+1,0) and then plot that data like any other data. If you need to adjust scaling or if Mathematica produces a very narrow graph then make the non-max points larger in the respective directions.

If you need the point at its original position then just add the x coordinate to every x point in the dataset.

3. Mar 29, 2012

### Bill Simpson

r = Plot[Sin[j], {j, 0, Pi}];
onedot = ListPlot[{j, 1} /. Rest[FindMaximum[Sin[j], {j, Pi}]], PlotStyle -> {Hue[0.67], AbsolutePointSize[7]}];
Show[r, onedot]

4. Mar 30, 2012

### shafieza_garl

thanx 4 ur reply.1 more question. if i dont want to put value 1 by myself and i want the same as finding the j-value(using findmaximum).
Code (Text):

onedot = ListPlot[{j, k} /. Rest[FindMaximum[Sin[j], {j, Pi}]],  PlotStyle -> {Hue[0.67], AbsolutePointSize[7]}];
is this possible to do?
thanks again.

5. Mar 30, 2012

### Bill Simpson

r = Plot[Sin[j], {j, 0, Pi}];
onedot = ListPlot[{j, Sin[j]} /. Rest[FindMaximum[Sin[j], {j, Pi}]], \
PlotStyle -> {Hue[0.67], AbsolutePointSize[7]}];
Show[r, onedot]