여러 줄로 둘러싸인 영역 채우기 및 텍스트 추가

여러 줄로 둘러싸인 영역 채우기 및 텍스트 추가

저는 Tex를 처음 접했고 tikz 패키지를 사용하여 그래프를 그리려고 합니다.

그래서 제가 작성한 코드는 다음과 같습니다

\documentclass{article}
\usepackage{tikz}
\begin{document}
\ifx\du\undefined
  \newlength{\du}
\fi
\setlength{\du}{15\unitlength}
\begin{tikzpicture}
\pgftransformxscale{1}
\pgftransformyscale{-1}
\pgfsetlinewidth{0.1\du}
\draw (0\du,0\du)--(13\du,-13\du);
\draw (0\du,0\du)--(4\du,-1\du);
\draw (4\du,-1\du)--(9\du,-5\du);
\draw (9\du,-5\du)--(11\du,-8\du);
\draw (11\du,-8\du)--(13\du,-13\du);
\node[anchor=west] at (7\du,-5\du){some text};
\end{tikzpicture}
\end{document}

나는 이 선들로 둘러싸인 영역을 채우고 "일부 텍스트"도 보이도록 하려고 합니다.

누군가 도와주실 수 있나요?

답변1

당신이 찾고 있는 것을 이해할 수 있듯이, 불필요한 저수준 pgf 라인을 제거하고 이에 따라 y 좌표를 수정하여 이를 방지하는 해결책이 있습니다.y 모양 변환.

충전 면적

\documentclass{article}
\usepackage{tikz}
\begin{document}
    \ifx\du\undefined
      \newlength{\du}
    \fi
    \setlength{\du}{15\unitlength}
    \begin{tikzpicture}
        \draw[line width=0.1\du, fill=pink] (0\du,0\du)--(13\du,13\du) -- (11\du,8\du) -- (9\du,5\du) -- (4\du,1\du) -- cycle;
        \node at (7\du,5\du){some text};
    \end{tikzpicture}
\end{document}

답변2

\documentclass[tikz, border=1cm]{standalone}
\begin{document}
\begin{tikzpicture}
\newcommand{\du}{15pt}
\draw[fill=cyan,very thick] (0,0) -- (13*\du,13*\du) -- (11*\du,8*\du) -- (9*\du,5*\du)  -- (4*\du,\du) -- cycle;
\node[anchor=west, red, font=\large] at (7*\du,5*\du){some text};
\end{tikzpicture}
\end{document}

텍스트가 있는 청록색 모양

관련 정보