Mathematica's ColorFunction seems to struggle with coloring a function "y" by its derivative D[y,x]. This is a seemingly simple task, but Mathematica can't handle it. While I can certainly evaluate the derivative outside of the ColorFunction, that then makes plotting several functions with the same command difficult.
For Example:
Plot[{x^2, Sin[x]}, {x, -1, 1}, ColorFunction -> Function[{x, y},ColorData["NeonColors"][y]]]
Generates a plot of x^2 and Sin[x] colored by their y values.
Plot[{x^2,Sin[x]}, {x, -1, 1}, ColorFunction -> Function[{x, y},ColorData["NeonColors"][D[y,x]]]]
Returns an error. Any suggestions?
Edit for Mr. Wizard, this workaround works but involves separately finding the derivative of each function and showing the two plots together:
Show[Plot[x^2, {x, -1, 1}, ColorFunction -> Function[{x, y}, ColorData["NeonColors"][2 x]]],Plot[Sin[x], {x, -1, 1},ColorFunction -> Function[{x, y}, ColorData["NeonColors"][Cos[x]]]], PlotRange -> {-1, 1}]