我想画下面的图,但是我对两个圆圈之间的区域感到困惑
我一直尝试使用,scope
但是我只能填满整个交叉路口。
\documentclass[tikz,border=10pt]{standalone}
\usetikzlibrary{arrows,intersections}
\begin{document}
\begin{tikzpicture}
\coordinate (O) at (0,0);
\draw[->][thin,color=blue] (0,0) -- (-3,0) coordinate[label = {below:$y$}];
\draw[->][thin,color=blue] (0,0) -- (0,3) coordinate[label = {right:$x$}];
\draw[->][thin,color=blue] (0,0) -- (3,-3) coordinate[label = {left:$z$}];
\draw (0,0) circle (2cm);
\draw (0,0) circle (2.25cm);
\def\circleone{ (0,0) circle (2cm) }
\def\circletwo{ (0,0) circle (2.25cm) }
\begin{scope}
\clip \circletwo;
\fill[white, opacity=0.2] \circleone;
\end{scope}
\begin{scope}
\clip
\circleone
(current bounding box.south west) rectangle
(current bounding box.north east);
\fill[blue,opacity=0.2] \circletwo;
\end{scope}
\end{tikzpicture}
\end{document}
答案1
这是最简单的方法。稍微复杂一点的方法就是让边垂直而不是倾斜。没有任何东西可以指示要把它做多宽。
\documentclass[tikz,border=10pt]{standalone}
\usetikzlibrary{arrows,intersections}
\begin{document}
\begin{tikzpicture}
\coordinate (O) at (0,0);
\draw[->][thin,color=blue] (0,0) -- (-3,0) coordinate[label = {below:$y$}];
\draw[->][thin,color=blue] (0,0) -- (0,3) coordinate[label = {right:$x$}];
\draw[->][thin,color=blue] (0,0) -- (3,-3) coordinate[label = {left:$z$}];
\draw (0,0) circle (2cm);
\draw (0,0) circle (2.25cm);
\fill[blue,opacity=0.2] (85: 2cm) arc[radius=2cm, start angle=85, end angle=95]
-- (95: 2.25cm) arc[radius=2.25cm, start angle=95, end angle=85] -- cycle;
\end{tikzpicture}
\end{document}
答案2
这里还有一个建议,使用even odd rule
蓝色填充。红色部分作为路径图片添加。
\documentclass[tikz,border=10pt]{standalone}
\usetikzlibrary{arrows,intersections,backgrounds}
\begin{document}
\begin{tikzpicture}
\coordinate (O) at (0,0);
\draw[->][thin,color=blue] (O) -- +(-3,0) coordinate[label = {below:$y$}];
\draw[->][thin,color=blue] (O) -- +(0,3) coordinate[label = {right:$x$}];
\draw[->][thin,color=blue] (O) -- +(3,-3) coordinate[label = {left:$z$}];
\begin{scope}[on background layer]
\draw[even odd rule,fill=blue,fill opacity=.2]
[path picture={\fill[red,opacity=1](O)+(-.2,0)rectangle+(.2,0|-current bounding box.north);}]
(O)
circle [radius=2]
circle[radius=2.25]
;
\end{scope}
\end{tikzpicture}
\end{document}
为了使轴位于顶部,我将它们绘制在背景层中。您也可以在圆圈后绘制轴。
(0,0)
此外,我还用已经定义的替换了所有(O)
,然后使用了相对于的坐标(O)
。
答案3
还有一个选择:
\documentclass[tikz,border=10pt]{standalone}
\usetikzlibrary{arrows,intersections}
\begin{document}
\begin{tikzpicture}[
ax/.style = {->, thin,color=blue},
]
\coordinate (O) at (0,0);
% circle
\draw[double=blue!30,double distance=2.5mm,thick]
(O) circle (21.25mm);
% arc segment
\filldraw[semithick,red!50]
(85:2.01) arc[radius=2.01, start angle=85, end angle=95] --
(95:2.24) arc[radius=2.24, start angle=95, end angle=85] -- cycle;
% axes
\draw[ax] (O) -- (-3,0) node[below] {$y$};
\draw[ax] (O) -- ( 0,3) node[left] {$x$};
\draw[ax] (O) -- (3,-3) node[right] {$z$};
%
\end{tikzpicture}
\end{document}
或者稍微简单一点:
\documentclass[tikz,border=10pt]{standalone}
\usetikzlibrary{arrows,intersections}
\begin{document}
\begin{tikzpicture}[
ax/.style = {->, thin,color=blue},
]
\coordinate (O) at (0,0);
% circle
\draw[double=blue!30,double distance=2.5mm,thick]
(O) circle (21.25mm);
% arc segment
\draw[double=red!50,double distance=2.5mm,thick]
(85:21.25mm) arc[radius=21.25mm, start angle=85, end angle=95];
% axes
\draw[ax] (O) -- (-3,0) node[below] {$y$};
\draw[ax] (O) -- ( 0,3) node[left] {$x$};
\draw[ax] (O) -- (3,-3) node[right] {$z$};
%
\end{tikzpicture}
\end{document}