1
$\begingroup$

Say I want to plot this

Plot[x,Sin[x],{x,0,4 Pi}]

And I want it to show 4 nicely spaced points, on the line. Is there an automatic way to do this?

I was reading this, but it's not in Mathematica forum and I can't comment because I dont have enough reputation. One of the answer is this

{plot, {points}} = Reap @ Plot[Last@Sow@{x, Sin[x]}, {x, 0, 4 Pi}]

This look like the closest thing to it, but I got this, as a return: enter image description here

Probably my mistake, but should the point {x,Sin[x]} be part of the points? I am running MMA10.0.1 X64 on windows 7 SP1.

How do I use the points obtained there, to add onto the original plot? Is there a more efficient way?

Thanks!

$\endgroup$

1 Answer 1

3
$\begingroup$

You can use the answer from 39394

Plot[Sin[x], {x, 0, 4 Pi}, Mesh -> 4 , MeshStyle -> {PointSize[Large]}]

enter image description here

$\endgroup$
1
  • $\begingroup$ Mesh works like a magic! $\endgroup$ Oct 19, 2014 at 22:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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