I want plot the max value in a sine plot. We can use the following code
Plot[Sin[x], {x, 0, 50}, Mesh -> {{.99}},
MeshFunctions -> {#2 &},
MeshStyle -> {PointSize[Large], Red}]
Why can't Mesh -> 1
be used to plot the red point?
But in a mathematics way, I want to use this code
Plot[Sin[x], {x, 0, 50},
Mesh -> {{1}},
MeshFunctions -> {Boole[(Cos[#] == 0) && (-Sin[#] < 0)] &},
MeshStyle -> {PointSize[Large], Red}]
You can see the MeshFunction
doesn't work? Why?
Then I try some other test. For example,I want to emphasize the point above 0.5 to draw on Red. I use this code
Plot[Sin[x], {x, 0, 50},
Mesh -> {{1}},
MeshFunctions -> {Boole[Greater[#2, 0.5]] &}]
It doesn't work again.
So I guess the equation PrimePi[z] == 2
will give 2 <= z < 3
. To see whether this region can plot in MeshFunction
, I tried the following:
f[x_, y_] := (x^2 + 3 y^2)*E^(1 - x^2 - y^2)
Plot3D[f[x, y], {x, -2, 2}, {y, -2, 2},
Mesh -> {{1}},
MeshFunctions -> {PrimePi[#3] &}]
You can see the plot is weird.
So what is my problem with MeshFunction
? Can I use MeshFunction
to plot the maximum value in a plot?
ContourPlot
: 23363, 32734. $\endgroup$ – Michael E2 Aug 25 '14 at 12:21Plot[Sin[x], {x, 0, 50}, Mesh -> {Pi/2 + 2 Pi Range[0, 50/(2 Pi)]}, MeshStyle -> {PointSize[Large], Red}]
be sufficient? Or do you seek a particular method of solution? $\endgroup$ – Michael E2 Aug 25 '14 at 13:34