Tooltip and table in plot [duplicate]

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

But why does

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


give

with no color difference?

• Evaluate has to be right after Plot. Try Plot[Evaluate@Tooltip@Table[a k^2, {a, 1, 2, 0.2}], {k, -2, 2}]. Commented Apr 1, 2013 at 2:21
• Related: this question, the second half of this answer, and perhaps this discussion. Commented Apr 1, 2013 at 2:33
• @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. Commented Apr 1, 2013 at 2:49
• @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[...],...]. Commented Apr 1, 2013 at 4: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. Commented Apr 1, 2013 at 10:21