1

I was trying to fill between areas but I can't imagine how to do it. I'm trying to fill the area between the segment A_5,A_6 and the piece of the curve outside the polygon, connecting A-5 and A_6.

\documentclass{standalone}
\usepackage{tikz, tkz-euclide}
\usetikzlibrary{hobby}
\usetkzobj{all}

\begin{document}
\begin{tikzpicture}[scale=2]
    \tkzDefPoints{-1.8/0/A_1, -0.5/1.2/A_2, -1.3/2.2/A_3, 0/3.7/A_4, 
    1.9/3.95/A_5, 3.4/3.3/A_6, 1.9/1.7/A_7, 3.6/0.9/A_8, 2.35/-1/A_9, 
    1/0.6/A_10, -1/-0.7/A_11}

    \draw[help lines, color=gray!30, dashed] (-2.5,-1.5) grid (4.1,5.1);
    \draw [->, >=stealth] (-2.5,0) -- (4.2,0) node [right] {$x$};
    \draw [->, >=stealth] (0,-1.5) -- (0,5) node [above] {$y$};

    \draw [very thick] (-1.8,0) to [closed, curve through = {(-1.5,0.2) 
     (-0.5,1.2) (-1.3,2.2) (0,3.7) (1.2,3.9)(1.8,3.945)(1.9,3.95) (3.4,3.3) 
    (2.5,2.6)(1.9,1.7) (2.2,1.6)(3.6,0.9) (3.65,0) (2.35,-1) (1.8,0) (1,0.6) 
    (0,0.3) (-0.2,0) (-1,-0.7) (-1.9,-0.7)}] (-1.8,0);

    \tkzDrawPolygon[very thick, dashed, fill=red!20,opacity=0.3]
    (A_1,A_2,A_3,A_4,A_5,A_6,A_7,A_8,A_9,A_10,A_11)

    \tkzDrawPolygon[very thick, fill=gray!30,opacity=.3]
    (A_1,A_3,A_4,A_5,A_6,A_8,A_9,A_11)

    \tkzDrawPoints[size=15,fill=black]
     (A_1,A_2,A_3,A_4,A_5,A_6,A_7,A_8,A_9,A_10,A_11)


    \tkzDrawSegment(A_5,A_6)
\end{tikzpicture}

\end{document}

enter image description here

  • \clip(A5)(A6)(100,100);\fill the curve; – Symbol 1 Jul 23 '17 at 20:33
  • I tried this but didn't work. – Irlexi Jul 23 '17 at 20:37
3
\documentclass{standalone}
\usepackage{tikz, tkz-euclide}
\usetikzlibrary{hobby}
\usetkzobj{all}

\begin{document}
    \begin{tikzpicture}[scale=2]
    \tkzDefPoints{-1.8/0/A_1, -0.5/1.2/A_2, -1.3/2.2/A_3, 0/3.7/A_4, 
        1.9/3.95/A_5, 3.4/3.3/A_6, 1.9/1.7/A_7, 3.6/0.9/A_8, 2.35/-1/A_9, 
        1/0.6/A_10, -1/-0.7/A_11,4/4/T_1,3.5/4.5/T_2}

    \draw[help lines, color=gray!30, dashed] (-2.5,-1.5) grid (4.1,5.1);
    \draw [->, >=stealth] (-2.5,0) -- (4.2,0) node [right] {$x$};
    \draw [->, >=stealth] (0,-1.5) -- (0,5) node [above] {$y$};

    \begin{scope}
    \path [clip] (-1.8,0) to [closed, curve through = {(-1.5,0.2) 
        (-0.5,1.2) (-1.3,2.2) (0,3.7) (1.2,3.9)(1.8,3.945)(1.9,3.95) (3.4,3.3) 
        (2.5,2.6)(1.9,1.7) (2.2,1.6)(3.6,0.9) (3.65,0) (2.35,-1) (1.8,0) (1,0.6) 
        (0,0.3) (-0.2,0) (-1,-0.7) (-1.9,-0.7)}] (-1.8,0);
    \tkzFillPolygon[fill=blue](A_5,A_6,T_1,T_2)
    \end{scope}


    \draw [very thick] (-1.8,0) to [closed, curve through = {(-1.5,0.2) 
        (-0.5,1.2) (-1.3,2.2) (0,3.7) (1.2,3.9)(1.8,3.945)(1.9,3.95) (3.4,3.3) 
        (2.5,2.6)(1.9,1.7) (2.2,1.6)(3.6,0.9) (3.65,0) (2.35,-1) (1.8,0) (1,0.6) 
        (0,0.3) (-0.2,0) (-1,-0.7) (-1.9,-0.7)}] (-1.8,0);

    \tkzDrawPolygon[very thick, dashed, fill=red!20,opacity=0.3]%
    (A_1,A_2,A_3,A_4,A_5,A_6,A_7,A_8,A_9,A_10,A_11)

    \tkzDrawPolygon[very thick, fill=gray!30,opacity=.3]%
    (A_1,A_3,A_4,A_5,A_6,A_8,A_9,A_11)

    \tkzDrawPoints[size=15,fill=black]%
    (A_1,A_2,A_3,A_4,A_5,A_6,A_7,A_8,A_9,A_10,A_11)

    \end{tikzpicture}

\end{document}

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.