I need to indicate the region in which a parabolic function y=f(x) is positive. I want to do this by filling the area above the function f(x). Because the plot, being finite, can only show part of of the area, I want to indicate the remaining area by transitioning from the fill color to white using shading toward the left, right, and top.
Here's a MWE that illustrates the problem I'm having:
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\filldraw[lightgray] (-0.8,0.64) parabola bend (0.0,0.0) (0.8,0.64)
-- (0.8,0.8) -- (-0.8,0.8);
\shade[left color=red] (0.8,0.64) -- (1.0,1.0) -- (0.8,0.8); % works
% \shade[left color=red] (0.8,0.64) parabola bend (0.0,0.0) (1.0,1.0)
% -- (0.8,0.8); % does not work
\shade[right color=blue,left color=white] (-0.8,0.64) -- (-1.0,1.0)
-- (-0.8,0.8);
\shade[bottom color=green,top color=white] (-1.0,1.0) -- (-0.8,0.8)
-- (0.8,0.8) -- (1.0,1.0);
\end{tikzpicture}
\end{document}
I first fill the region above the parabola in gray and then add three pieces (here shown in red, blue, and green to make them easier to see). This gives:
If I were to change the colors red and blue to light gray, this would be close to what I need. The problem is that the bottom boundaries of the red and blue pieces are given by straight lines, not by the parabola. If I uncomment the lines that are commented out in the MWE so that the bottom boundaries are given by the parabola, the color in the red region changes - it becomes much lighter:
My first question is how can I avoid the lighter color? My second question is how to avoid the discontinuity in the function value where the gray and red/blue regions meet?
\fill[bottom color=lightgray,top color=white] (-1,1) parabola bend (0.0,0.0) (1,1)--cycle;