如何填充这个椭圆和圆

如何填充这个椭圆和圆

我试图填充该图形的某些区域,但没有成功。

这是我的代码

\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}

在此处输入图片描述

有人能帮助我吗?

答案1

像这样吗?(请注意,轮廓比需要的要复杂一些,但这些选择允许您降低不透明度而不会产生不必要的意外。)

\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}

在此处输入图片描述

请注意,其他部分也比必要的要复杂一些,但代码可能来自绘图程序,因此我认为简化它没什么意义。另外,您的图片太宽,因此您可能需要缩小它或放大页面尺寸。

相关内容