가능한 지역을 플롯하고 싶습니다. 하지만 어떻게 해야 할지 모르겠습니다. 지도가 필요해요.
\documentclass[tikz, border=5mm]{standalone}
\begin{document}
\begin{tikzpicture}
\draw[gray!50, thin, step=0.5] (-1,-3) grid (5,4);
\draw[very thick,->] (-1,0) -- (5.2,0) node[right] {$x_1$};
\draw[very thick,->] (0,-3) -- (0,4.2) node[above] {$x_2$};
\foreach \x in {-1,...,5} \draw (\x,0.05) -- (\x,-0.05) node[below] {\tiny\x};
\foreach \y in {-3,...,4} \draw (-0.05,\y) -- (0.05,\y) node[right] {\tiny\y};
\draw (-1,-3) -- node[above,sloped] {\tiny$x_1=-1$} (-1,3);
\draw (0,0) -- node[above,sloped] {\tiny$x_1\leq x_2$} (3,3);
\draw (0,0) -- node[above,sloped] {\tiny$x_1\leq x_2$} (3,-3);
\draw (-1,3) -- node[above,sloped] {\tiny$x_2=3$} (3,3);
\draw (-1,3) -- node[above,sloped] {\tiny$x_2=-3$} (3,3);
\end{tikzpicture}
\end{document}
현재 결과:
답변1
결과가 정확히 어떻게 보일지 잘 모르겠지만 이것이 도움이 될 수 있습니다.
영역을 그리려면 이 영역의 경계를 나타내는 선을 연결해야 합니다. 그렇지 않으면 연결되지 않은 단일 선만 얻게 됩니다. 또한 해당 영역이 다이어그램의 일부를 덮지 않아야 하는 경우 해당 영역을 덮지 말아야 할 항목 앞에 배치해야 합니다.
\documentclass[tikz, border=10pt]{standalone}
\begin{document}
\begin{tikzpicture}
\draw[gray!50, thin, step=0.5] (-1,-3) grid (5,4);
\draw[fill=gray!10]
(-1,-3)
-- node[above, sloped] {\tiny$x_1=-1$} (-1,3)
-- node[above, sloped] {\tiny$x_2=3$} (3,3)
-- node[above, sloped] {\tiny$x_1\leq x_2$} (0,0)
-- node[above, sloped] {\tiny$x_1\leq -x_2$} (3,-3)
-- node[above, sloped] {\tiny$x_2=-3$} cycle;
\draw[very thick, ->] (-1,0) -- (5.2,0) node[right] {$x_1$};
\draw[very thick, ->] (0,-3) -- (0,4.2) node[above] {$x_2$};
\foreach \x in {-1,...,5}
\draw (\x,0.05) -- (\x,-0.05)
\ifnum\x=0\relax
node[below right] {\tiny\x}
\else
node[below] {\tiny\x}
\fi ;
\foreach \y in {-3,...,4}
\draw (-0.05,\y) -- (0.05,\y)
\ifnum\y=0\else
node[right] {\tiny\y}
\fi ;
\draw[very thick, <->]
(0:2) arc[start angle=0, end angle=45, radius=2]
node[midway, right] {\tiny$q$};
\node[align=center] at (3,-2) {unstable \\ region};
\node[align=center] at (1,-2) {stable \\ region};
\end{tikzpicture}
\end{document}
대부분의 레이블과 그리드가 제거되면 표시된 그림과 더 유사해집니다.
\documentclass[tikz, border=10pt]{standalone}
\begin{document}
\begin{tikzpicture}
\draw[fill=gray!10]
(-1,-3) -- (-1,3) -- (3,3) -- (0,0) -- (3,-3) -- cycle;
\draw[very thick, ->] (-1,0) -- (3,0) node[right] {$x_1$};
\draw[very thick, ->] (0,-3) -- (0,3.5) node[above] {$x_2$};
\draw[very thick, <->]
(0:2) arc[start angle=0, end angle=45, radius=2]
node[midway, right] {$q$};
\node[align=center] at (3,-2) {unstable \\ region};
\node[align=center] at (1,-2) {stable \\ region};
\end{tikzpicture}
\end{document}