Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I've plotted a function that varies with respect to time. It's inside a manipulate box, which can vary the time. And I'd like to display the value of the function at the time on the slider on my plot.

I've seen it done before, but I've been trying unsuccessfully for the last 40 or so minutes to find out how. Any ideas?

share|improve this question
    
Show us the code you have and maybe someone can help. –  bill s Oct 24 '13 at 14:45
add comment

1 Answer 1

up vote 4 down vote accepted

There are many ways to do this, depending on how you want to display the coordinates. The following example displays the coordinates in four ways (other than reading them from the graph itself).

1) The first uses a Text graphics primitive in the Epilog option.

2) The second uses the Tooltip applied to a Point graphics primitive also in the Epilog option. If you hover your mouse over the point, the tooltip will popup displaying the tooltip text (in this case the coordinates).

3) The third uses the PlotLabel option to display the coordinate text.

4) The fourth displays the coordinates outside of the plot altogether in a different cell of a display Grid.

f[x_] := x^2;
Manipulate[Grid[{
 {{t, f[t]}},
 {Plot[f[x], {x, 0, 1}, 
   Epilog -> {PointSize[Large], Red,
              Tooltip[Point[{t, f[t]}], {t, f[t]}],
              Text[{t, f[t]}, {0.3, 0.8}]}, 
   PlotLabel -> {t, f[t]}]}
}], {t, 0, 1}]

Display coordinates of a point on a plot

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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