0
Plot[Tooltip@{1.` k^2, 1.2` k^2, 1.4` k^2, 1.6` k^2, 1.8` k^2, 2.` k^2}, {k, -2, 2}]

gives

enter image description here

But why does

Plot[Tooltip@Evaluate@Table[a k^2, {a, 1, 2, 0.2}], {k, -2, 2}]

give

enter image description here with no color difference?

Verbeia
  • 34,233
  • 9
  • 109
  • 224
matheorem
  • 17,132
  • 8
  • 45
  • 115
  • 1
    Evaluate has to be right after Plot. Try Plot[Evaluate@Tooltip@Table[a k^2, {a, 1, 2, 0.2}], {k, -2, 2}]. – Michael E2 Apr 01 '13 at 02:21
  • 1
  • @MichaelE2 Thank you. But I still don't get it. In the first example, I use Tooltip@List in Plot, it works well. In the second example, I use "Evaluate" before "Table" in order to turn the "Table" expr into a list first, because I know "Plot" will consider the "Table" as a single entity without "Evaluate", So I think it should be the same as the first example with "Evaluate". But it is not. And you proposed to let the "Evaluate" before "Tooltip", then it works! Wow, I still don't know why. – matheorem Apr 01 '13 at 02:49
  • 1
    @matheorem When you pinned down the error, you always have to check the doc's of Evaluate again. Under Details it clearly says: "Evaluate only overrides HoldFirst, etc. attributes when it appears directly as the head of the function argument that would otherwise be held". Therefore, Evaluate has always be the most outwards function of an argument: f[Evaluate[...],...]. – halirutan Apr 01 '13 at 04:13
  • @matheorem It takes a while to get used to the fact that some Mathematica commands hold (keep unevaluated) some or all of the arguments, and Evaluate overrides it. Evaluate@Tooltip@Table... evaluates to Tooltip@List... before being passed to Plot. I don't know what else to add to halirutan's explanation. – Michael E2 Apr 01 '13 at 10:21

0 Answers0