Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If k=3, then I would like the following to say "Sine Curve, k=3" when you hover over the output of the Tooltip command:

Tooltip[Sin[k*x], "Sine Curve, k=", TooltipStyle -> FontSize -> 16]

I have made a number of attempts, using pure functions and substitutions, but none delivered the output I want. The ultimate goal is to put this into a Manipulate where k is a user selectable value and the Sin[k x] function is plotted.

share|improve this question
up vote 3 down vote accepted

String manipulation like in jVincent's answer is nice, but I normally prefer to combine these types of elements using Row:

 Plot[Tooltip[Sin[k x], Row[{"Sine Curve, k=", k}]], {x, 0, 4 Pi}], 
      {k, 1, 5}]

For more complicated objects, it just normally ends up being neater. Maybe my preference comes from having to work with RowBox and MakeExpression too much...
Aside: I would also use "\[VeryThinSpace]\[LongEqual]\[VeryThinSpace]" instead of just "=",
it looks nicer:
and in Mathematica, "=" is normally associated with Set.

share|improve this answer
Thank you, I do like the way this looks. Especially when you are presenting larger fonts on a projector screen! – Joseph Jan 6 '13 at 14:42

You can insert the value into the tooltip using ToString:

 Plot[Tooltip[Sin[k x], "Sine Curve, k=" <> ToString[k]], {x, 0, 4 \[Pi]}],
 {k, 1, 5}]
share|improve this answer
This is exactly I was looking for, Thank you very much! – Joseph Dec 21 '12 at 20:10

Your Answer


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.