0

I asked a question yesterday, Filling this parabola with pattern to which was answered by the community and I have one more question to ask - how do I construct a small coloured/shaded strip in this parabola? Something that resembles:

enter image description here

1 Answer 1

0

use \clip,as follows

\documentclass[tikz, border=3.141592]{standalone}
\usetikzlibrary{patterns.meta}

\begin{document}
    \begin{tikzpicture}[
dot/.style = {circle, fill, node contents={},
              inner sep=1.6pt, outer sep=0pt}
                        ]
% axis
\draw[->] (-3,0.0) -- (3,0) node [below left] {$x$};
\draw[->] (0,-0.5) -- (0,6) node [below left] {$y$};
% parabola 
\draw  [thick, 
        pattern={Lines[angle=45,distance={3pt},line width=0.2pt]},
                 pattern color=gray]
       (-2,5) parabola bend (0,0) (2,5);
\draw[densely dotted, semithick] 
    (-2,5) node[dot]-- (2,5) node[dot];
% coordinate origin
\path (0,0) node[below left] {(0,0)};

\clip (-2,5) parabola bend (0,0) (2,5);
\draw  [red, 
        pattern={Lines[angle=60,distance={1.5pt},line width=0.2pt]},
                 pattern color=red] (0.5,0) rectangle (1.5,5);
\end{tikzpicture}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.