Plot[x^2, {x, -2, 2}, Filling -> {1 -> Top},
FillingStyle -> Automatic,
ColorFunction -> {Function[{x, y}, ColorData["Rainbow"][4 y]]}]
The above code produces a graph
However, I want it to be filled vertically. The colour gradient should be along Y-Axis, which is currently along X-Axis. Changing y to x (...ColorData["Rainbow"][4 y]]
) doesn't solve the problem.
Please help me out.