
답변1
일반적으로 Tobi가 제공한 조언을 따르는 것이 좋지만 이는 매우 간단하므로 어쨌든 대답하겠습니다. 또한 시작 부분에서 튜토리얼을 보지 않았다면 참고하겠습니다.TikZ 매뉴얼, 그렇게 하는 것이 좋습니다. 그 중 첫 번째(2장)에서는 그러한 다이어그램을 만드는 데 필요한 모든 것을 가르쳐 줄 것입니다.
축을 그리는 것은 문제가 되지 않을 것 같습니다. 그것은 단지 두 개의 직선일 뿐입니다.
절단된 원의 경우 두 개의 호와 두 개의 직선으로 구성됩니다. 호를 그리려면 다음을 사용할 수 있습니다.
arc[start angle=<degrees>, end angle=<degrees>, radius=<length>]
start angle
그러면 에서 까지 원의 일부가 시계 반대 방향으로 그려집니다 end angle
. ( 을 수행할 수도 있습니다 arc[start angle=<degrees>, delta angle=<degrees>, radius=<length>]
. 여기서 은 delta angle
호 길이를 도 단위로 나타냅니다.)
원의 가장 오른쪽 지점에서 그리기 시작한다고 가정해 보겠습니다. 에 있다는 것을 알고 있으므로 (2,0)
다음으로 시작합니다.
\draw (2,0) ...
이 지점 아래에 레이블을 추가하려고 하며 나중에 추가할 수도 있지만 이 경우 동시에 추가하는 것이 편리할 수 있습니다. 텍스트는 다음을 사용하여 추가됩니다 node [<options>] {<text>}
.
\draw (2,0) node[below] {2} ...
(노드를 별도로 추가한다면 하시면 됩니다 \node [<options>] at (<coordinate>) {<text>};
.)
거기에서 0의 각도에서 시작하여 (sin(30) = 0.5이기 때문에) 30도를 포괄하는 호를 그리려고 합니다. 위에서 말한 내용에 따라 :
\draw (2,0) node[below] {2}
arc[start angle=0, end angle=30, radius=2] node[right] {1}...
여기에 해당 호의 끝점 오른쪽에 레이블도 추가했습니다.
다음 부분은 왼쪽 호가 시작되는 곳까지 직선을 그리는 것입니다. 수동으로 또는 좌표에서 직접 x/y 좌표를 계산할 수 있지만 다음으로 지정된 극좌표를 사용하는 것이 더 편리합니다 (<angle> : <radius>)
.
\draw (2,0) node[below] {2}
arc[start angle=0, end angle=30, radius=2] node[right] {1}
-- (150:2) ...
이제 두 번째 호를 그려 node
레이블에 을 추가하고 마지막으로 직선을 다시 시작합니다. 닫힌 경로를 그릴 때 첫 번째 좌표 사용을 반복하는 대신 다음을 사용하십시오 cycle
.
\draw (2,0) node[below] {2}
arc[start angle=0, end angle=30, radius=2] node[right] {1}
-- (150:2)
arc[start angle=150, end angle=180, radius=2] node[below] {2}
-- cycle;
\draw
단독으로는 검은색 선만 표시되지만 색상을 지정하고 옵션을 채울 수 있습니다.
\filldraw [
fill=brown!80!black,
draw=red,
very thick
]
(2,0) node[below] {2}
arc[start angle=0, end angle=30, radius=2] node[right] {1}
-- (150:2)
arc[start angle=150, end angle=180, radius=2] node[below] {2}
-- cycle;
( 이 경우와 같이 and 를 모두 지정할 때 \filldraw
대신을 사용할 필요는 없습니다.)\draw
fill=<color>
draw=<color>
\documentclass[border=5mm]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\path [
fill=brown!80!black,
draw=red,
very thick
]
(2,0) node[below] {2}
arc[start angle=0, end angle=30, radius=2] node[right] {1}
-- (150:2)
arc[start angle=150, end angle=180, radius=2] node[below] {2}
-- cycle;
\draw [thick] (-3,0) -- (3,0);
\draw [thick] (0,-2) -- (0,2);
\end{tikzpicture}
\end{document}
답변2
tkz-euclide에 대한 답변이 추가되었습니다.
\documentclass{article} % or another class
\usepackage{xcolor} % before tikz or tkz-euclide if necessary
\usepackage{tkz-euclide} % no need to load TikZ
\usetikzlibrary{babel} %if there are problems with the active characters
\begin{document}
\begin{tikzpicture}
%define the origin O -- radius A
\tkzDefPoint(0,0){O}
\tkzDefPoint(1.41,0){A}
\tkzDrawPoints(O,A)
\tkzLabelPoints[below](O,A)
%draw the semicircle
\tkzDefPointBy[rotation= center O angle 180](A)
\tkzGetPoint{B}
\tkzDrawArc[line width=0.1pt, white](O,A)(B)
\tkzLabelPoints[below](B)
%draw the line at y=1
\tkzDefPoint(1,0){A'}
\tkzDefPoint(-1,0){B'}
\tkzDefShiftPoint[A'](90:1){A''}
\tkzDefShiftPoint[B'](90:1){B''}
\tkzDrawSegment[red,line width=1pt](A'',B'')
%draw the arc perimeter line
\tkzDrawArc[red,line width=1pt](O,A)(A'')
\tkzDrawArc[red,line width=1pt](O,B'')(B)
%color the fill inside
\fill[red!40] (-1,0) rectangle (1,1);
\tkzFillSector[rotate,color=red!40](O,A)(45)
\tkzFillSector[rotate,color=red!40](O,B)(-45)
%draw the center axis -horizontal and vertical
\tkzDrawLine(A,B)
\tkzDefLine[orthogonal =through O](B,A)\tkzGetPoint{X}
\tkzDrawLine(O,X)
\end{tikzpicture}
\end{document}