tikz의 점선

tikz의 점선

나는 이 그림에 대한 코드를 작성했습니다. 이 두 개의 대시를 어떻게 추가할 수 있습니까? 여기에 이미지 설명을 입력하세요

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows,positioning,fit}
\usetikzlibrary{arrows,calc,positioning}
\usetikzlibrary{shapes,arrows,positioning,calc}
\begin{document}
    \newlength\estilength
    \settowidth\estilength{$estimator$}
    \tikzset{
        block/.style = {draw, fill=white, rectangle, minimum height=3em, minimum width=3em,text width=\estilength,align=center},
        tmp/.style  = {coordinate}, 
        sum/.style= {draw, fill=white, circle, node distance=1cm},
        input/.style = {coordinate},
        output/.style= {coordinate},
        pinstyle/.style = {pin edge={to-,thin,black}
        },
        point/.style = {draw, fill=black, circle, minimum size=0.8mm, node distance=1.5cm, inner sep=0pt},
        dashed node/.style={draw,dashed,inner sep=7.5pt,rounded corners},
    }%
    \begin{tikzpicture}[auto, node distance=15mm,>=latex']
        \node [input, name=input] {};
        
        \node [block, right=of input] (plant) {$controller$};
        
        
    \end{tikzpicture}
\end{document}

답변1

이를 수행하는 방법은 다음과 같습니다.

특히 Tikz의 초보자라면 단계별로 수행하고 댓글에서 내 숫자를 확인한 후 다음 단계로 넘어가는 것이 좋습니다.불완전한에게괜찮아 (충분히).

내 의견을 넘어서는 몇 가지 의견:

  • 절대 좌표를 사용하면 초보자로서 더 많은 제어가 가능합니다. 나중에 positioning라이브러리나 다른 도구 로 이동할 수 있습니다.
  • 항상 간단하게 시작합니다(예 \draw (A) -- (B);: 직선). 나중에 다듬습니다 \draw (A) |- (B);(예: 수직, 수평 연결).
  • 스타일을 사용하여 코드를 더 읽기 쉽게 만드세요
  • 중간점 도입(예: 상대 좌표 +()또는 새로운 절대 ++()좌표)
  • Tikz는 경로 개념을 사용하여 구문적으로 로 시작하고 \로 끝나며 ;그 사이에 모든 작업을 수행합니다.
  • 그렇기 때문에 경로가 끝나기 전에 node(! 없이 ) 레이블을 배치할 수 있습니다.\
  • anchor노드에서 참조를 변경하는 데 사용하는 것이 좋습니다.center
  • 극좌표는 와 같은 좌표 (45:1)또는 노드 모양 주위의 친구가 될 수 있습니다.(A.north) == (A.90)

행운을 빕니다. + 다음 명령을 찾아보세요.tikz 매뉴얼병행하여.

결과

\documentclass[10pt,border=3mm,tikz]{standalone}
% ~~~ (4) replace arrow tip ~~~~~~~~~~
\usetikzlibrary{arrows.meta}

\begin{document}
 \begin{tikzpicture}[ % ~~~ (2) doing some style ~~~
    blk/.style={draw,minimum height=1cm,minimum width=3cm},
    LL/.style={line width=3pt, draw=blue!70!green!40},
    >={Triangle}, % ~~~ (4) replace arrow tip ~~~~~~~~~~
 ]
    % ~~~ (1) putting a node ~~~~~~~~
    \node[blk] (C) at (0,0) {controller};
    
    % ~~~ (3) drawing the blue line ~~~~~~
    \draw[->,LL]  (6,1.5) -| (C);
    
    % ~~~ (5) left indicator ~~~~~~~~~~~~
    \draw[dashed] (C.120) -- ++(100:3) -- +(-4,0) 
            node[anchor=south west] {distributed controller}; 

    % ~~~ (6) right indicator ~~~~~~~~~~~~
    \draw[dashed] (2,1.5) -- ++(45:2) -- +(4,0)
            node[anchor=south east] {communication topology}
            node[anchor=north east,pos=.6] {delay}
            ;   
 \end{tikzpicture}
\end{document}

관련 정보