1

I'm trying to fill some region of that figure but it doesn't work.

This is my code

\documentclass[10pt]{article}
\usepackage{pgf,tikz}
\usetikzlibrary{arrows}
\pagestyle{empty}
\begin{document}
\definecolor{uuuuuu}{rgb}        {0.26666666666666666,0.26666666666666666,0.26666666666666666}
\definecolor{cqcqcq}{rgb}    {0.7529411764705882,0.7529411764705882,0.7529411764705882}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle     45,x=1.0cm,y=1.0cm]
\draw [color=cqcqcq,dash pattern=on 3pt off 3pt, xstep=1.0cm,ystep=1.0cm]     (-7.0,-6.0) grid (7.0,6.0);
\draw[->,color=black] (-7.0,0.0) -- (7.0,0.0);
\foreach \x in {-7.0,-6.0,-5.0,-4.0,-3.0,-2.0,-1.0,1.0,2.0,3.0,4.0,5.0,6.0}
\draw[shift={(\x,0)},color=black] (0pt,2pt) -- (0pt,-2pt) node[below]     {\footnotesize $\x$};
\draw[->,color=black] (0.0,-6.0) -- (0.0,6.0);
\foreach \y in {-6.0,-5.0,-4.0,-3.0,-2.0,-1.0,1.0,2.0,3.0,4.0,5.0}
\draw[shift={(0,\y)},color=black] (2pt,0pt) -- (-2pt,0pt) node[left]     {\footnotesize $\y$};
\draw[color=black] (0pt,-10pt) node[right] {\footnotesize $0$};
\clip(-7.0,-6.0) rectangle (7.0,6.0);
\draw [line width=2.0pt] (0.0,0.0) circle (5.0cm);
\draw [rotate around={0.0:(0.0,0.0)},line width=2.0pt] (0.0,0.0) ellipse (5.0cm and 2.0cm);
\draw [line width=2.0pt] (-0.0,-6.0) -- (-0.0,6.0);
\draw [line width=2.0pt,domain=-7.0:7.0] plot(\x,{(-0.0-0.0*\x)/1.0});
\begin{scriptsize}
\draw[color=black] (-2.444000566779705,4.000803600484532) node {$c$};
\draw[color=black] (-2.444000566779705,1.4454057992225113) node {$d$};
\draw[color=black] (0.2196768023323968,6.382954093186416) node {$g$};
\draw[color=black] (-8.637591847804593,0.3626101207216553) node {$h$};
\draw [fill=uuuuuu] (-5.0,0.0) circle (1.5pt);
\draw[color=uuuuuu] (-4.847806973051602,0.2976423800116039) node {$A$};
\draw [fill=uuuuuu] (-0.0,5.0) circle (1.5pt);
\draw[color=uuuuuu] (0.15470906162234555,5.300158414685559) node {$B$};
\draw [fill=uuuuuu] (-0.0,2.0) circle (1.5pt);
\draw[color=uuuuuu] (0.15470906162234555,2.3116423420231964) node {$C$};
\draw [fill=uuuuuu] (5.0,0.0) circle (1.5pt);
\draw[color=uuuuuu] (5.157225096296292,0.2976423800116039) node {$D$};
\draw [fill=uuuuuu] (0.0,-5.0) circle (2.5pt);
\draw[color=uuuuuu] (0.15470906162234555,-4.618250000382282) node {$E$};
\end{scriptsize}
\fill[red] (0,2) -- (0,5) -- (5,0) -- cycle;
\fill[pink] (0,2) -- (0,5) -- (-5,0) -- cycle;
\fill[green] (0,-2) -- (0,-5) -- (5,0) -- cycle;
\fill[blue] (0,-2) -- (0,-5) -- (-5,0) -- cycle;
\end{tikzpicture}
\end{document}

enter image description here

Could someone help me?

1 Answer 1

1

Something like this? (Note that the contours are a bit more complicated than they need to be, but these choices allow you to decrease the opacity without unwanted surprises.)

\documentclass[10pt]{article}
\usepackage{tikz}
\usetikzlibrary{arrows}
\pagestyle{empty}
\begin{document}
\definecolor{uuuuuu}{rgb}        {0.26666666666666666,0.26666666666666666,0.26666666666666666}
\definecolor{cqcqcq}{rgb}    {0.7529411764705882,0.7529411764705882,0.7529411764705882}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle     45,x=1.0cm,y=1.0cm]
\draw [color=cqcqcq,dash pattern=on 3pt off 3pt, xstep=1.0cm,ystep=1.0cm]     (-7.0,-6.0) grid (7.0,6.0);
\fill[red] (5,0) arc(0:90:5.0cm) -- (0,2) arc(90:0:5cm and 2cm);
\fill[black!70] (5,0) arc(0:90:5.0cm and 2.0cm) |- cycle;
\fill[pink] (-5,0) arc(180:90:5.0cm) -- (0,2) arc(90:180:5cm and 2cm);
\fill[purple] (-5,0) arc(180:90:5.0cm and 2.0cm) |- cycle;
\fill[green] (5,0) arc(0:-90:5.0cm) -- (0,-2) arc(-90:0:5cm and 2cm);
\fill[orange] (5,0) arc(0:-90:5.0cm and 2cm) |- cycle;
\fill[blue] (-5,0) arc(-180:-90:5.0cm) -- (0,-2) arc(-90:-180:5cm and 2cm);
\fill[cyan] (-5,0) arc(-180:-90:5.0cm and 2cm) |- cycle;

\draw[->,color=black] (-7.0,0.0) -- (7.0,0.0);
\foreach \x in {-7.0,-6.0,-5.0,-4.0,-3.0,-2.0,-1.0,1.0,2.0,3.0,4.0,5.0,6.0}
\draw[shift={(\x,0)},color=black] (0pt,2pt) -- (0pt,-2pt) node[below]     {\footnotesize $\x$};
\draw[->,color=black] (0.0,-6.0) -- (0.0,6.0);
\foreach \y in {-6.0,-5.0,-4.0,-3.0,-2.0,-1.0,1.0,2.0,3.0,4.0,5.0}
\draw[shift={(0,\y)},color=black] (2pt,0pt) -- (-2pt,0pt) node[left]     {\footnotesize $\y$};
\draw[color=black] (0pt,-10pt) node[right] {\footnotesize $0$};
\clip(-7.0,-6.0) rectangle (7.0,6.0);
\draw [line width=2.0pt] (0.0,0.0) circle (5.0cm);
\draw [rotate around={0.0:(0.0,0.0)},line width=2.0pt] (0.0,0.0) ellipse (5.0cm and 2.0cm);
\draw [line width=2.0pt] (-0.0,-6.0) -- (-0.0,6.0);
\draw [line width=2.0pt,domain=-7.0:7.0] plot(\x,{(-0.0-0.0*\x)/1.0});
\begin{scope}[node font=\scriptsize]
\draw[color=black] (-2.444000566779705,4.000803600484532) node {$c$};
\draw[color=black] (-2.444000566779705,1.4454057992225113) node {$d$};
\draw[color=black] (0.2196768023323968,6.382954093186416) node {$g$};
\draw[color=black] (-8.637591847804593,0.3626101207216553) node {$h$};
\draw [fill=uuuuuu] (-5.0,0.0) circle (1.5pt);
\draw[color=uuuuuu] (-4.847806973051602,0.2976423800116039) node {$A$};
\draw [fill=uuuuuu] (-0.0,5.0) circle (1.5pt);
\draw[color=uuuuuu] (0.15470906162234555,5.300158414685559) node {$B$};
\draw [fill=uuuuuu] (-0.0,2.0) circle (1.5pt);
\draw[color=uuuuuu] (0.15470906162234555,2.3116423420231964) node {$C$};
\draw [fill=uuuuuu] (5.0,0.0) circle (1.5pt);
\draw[color=uuuuuu] (5.157225096296292,0.2976423800116039) node {$D$};
\draw [fill=uuuuuu] (0.0,-5.0) circle (2.5pt);
\draw[color=uuuuuu] (0.15470906162234555,-4.618250000382282) node {$E$};
\end{scope}
\end{tikzpicture}
\end{document}

enter image description here

Please note that the other parts are also a bit more complicated than necessary, but presumably the code stems from a drawing program so I do not see much point in simplifying it. Also your picture is too wide, so you may want to either scale it down or enlarge the page size.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .