극평면의 그리드로 동심원을 어떻게 만들 수 있나요?

극평면의 그리드로 동심원을 어떻게 만들 수 있나요?

하지만 에서 x, y에 대한 원의 경계를 정해야 합니다 [-2,6].

\begin{tikzpicture}
\draw[yellow!10, fill=hkvbluelogo!5](-2, -2) rectangle (6, 6);
\foreach \s in {0, 1, 2} {
  \draw [lightgray] (0,0) circle (\s + 0.5);
  \draw (0,0) circle (\s);
  \draw [thick,color=red,domain=0:2*pi,samples=200,smooth] plot (xy polar cs:angle=\x r,radius=\s );
}
\end{tikzpicture}

회색 부분에만 원을 그리고 싶습니다.

여기에 이미지 설명을 입력하세요

답변1

잘라낼 콘텐츠(이 경우 원)가 포함된 환경 \clip <path>;내에서 첫 번째 명령으로 사용합니다 .scope

클리핑 경로는 임의의 경로일 수 있지만 추가 스타일 옵션을 설정할 수 없으므로 다른 곳에 그려진 색상 사각형을 재사용할 수 없습니다.

\documentclass[tikz,border=2pt]{standalone}

\begin{document}
\begin{tikzpicture}
\draw[yellow!10, fill=blue!10](-2, -2) rectangle (6, 6);
\begin{scope}
\clip (-2, -2) rectangle (6, 6);
\foreach \s in {0, 1, 2} {
  \draw [lightgray] (0,0) circle (\s + 0.5);
  \draw (0,0) circle (\s);
  \draw [thick,color=red,domain=0:2*pi,samples=200,smooth] plot (xy polar cs:angle=\x r,radius=\s );
}
\end{scope}
\end{tikzpicture}
\end{document}

여기에 이미지 설명을 입력하세요

관련 정보