내 시도에 대한 코드

내 시도에 대한 코드

다음과 같은 "흐름도"를 그리려고 합니다.

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

약간의 고민 끝에 다음과 같은 해결책을 생각해낼 수 있었습니다.

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

제가 겪고 있는 문제는 크게 두 가지로 요약됩니다.

  • 화살표가 상자에 직각으로 닿도록 화살표를 정렬하려면 어떻게 해야 합니까? 지금 나는 추측하고 그것들을 어디에 놓을지 대략적으로 추측했습니다.
  • 이미지에 표시된 것처럼 굵은 화살표를 쉽게 얻을 수 있는 방법이 있나요?

원하는 이미지를 얻기 위한 대체 솔루션은 언제나 환영합니다.

내 시도에 대한 코드

\documentclass{article} 

\usepackage{xcolor}
\definecolor{UiT-main}{HTML}{003349}
\definecolor{UiT-red}{HTML}{CB333B}
\definecolor{UiT-blue}{HTML}{007396}
\definecolor{UiT-cyan}{HTML}{59BEC9}
\definecolor{UiT-orange}{HTML}{F2A900}

\usepackage{tikz}
\usetikzlibrary{shapes,arrows,calc}

% Define block styles
\tikzstyle{sun} = [circle,minimum height=0.6cm, draw, fill=UiT-orange, 
text width=4.5em, text badly centered, node distance=3cm, inner sep=0pt]
\tikzstyle{sunEmpty} = [circle,minimum height=0.6cm, 
text width=4.5em, text badly centered, node distance=3cm, inner sep=0pt]
\tikzstyle{block} = [rectangle, draw, fill=green!20, 
text width=20em, text centered, minimum height=4em]
\tikzstyle{line} = [draw, -latex']

\begin{document}

\begin{tikzpicture}[node distance = 2cm, auto]
% Place nodes
\node [sun] (Sun) {Sun};
\node [sunEmpty,right of=Sun] (SunEmpty) {};
\node [block, right of=Sun, yshift=-2cm] (greenhouse) {Greenhouse layer};
\node [block, fill=black!20, below of=greenhouse, yshift=-2cm] (surface) {surface};
% Draw edges  
\path [line] (Sun) -- node {}($(surface.north west)!0.23!(surface.north east)$);
\path [line,shorten <=0.25cm,shorten >=0.25cm] (surface) -- node {}(greenhouse);
\path [line] ($(greenhouse.north west)!0.64!(greenhouse.north east)$) -- node {}(SunEmpty.north);
\end{tikzpicture}
\end{document}

답변1

화살표가 상자에 직각으로 닿도록 화살표를 정렬하려면 어떻게 해야 합니까? 지금 나는 추측하고 그것들을 어디에 놓을지 대략적으로 추측했습니다.

좌표는 (surface.north-|sun)x 좌표 값 sun과 y 좌표 값을 갖습니다 surface.north. 따라서 path아래는 상자 ( surface)에 직각으로 부딪히게 됩니다.

\path (Sun) -- (surface.north-|Sun);

이미지에 표시된 것처럼 굵은 화살표를 쉽게 얻을 수 있는 방법이 있나요?

증가하다 line width.

또한 화살표가 노드에 닿지 않도록 outer sepof 를 조정했습니다.node여기에 이미지 설명을 입력하세요

MWE

\documentclass[margin=3mm]{standalone} 
\usepackage{xcolor}
\usepackage{tikz}
\definecolor{UiT-main}{HTML}{003349}
\definecolor{UiT-red}{HTML}{CB333B}
\definecolor{UiT-blue}{HTML}{007396}
\definecolor{UiT-cyan}{HTML}{59BEC9}
\definecolor{UiT-orange}{HTML}{F2A900}

% Define block styles
\tikzset{sunEmpty/.style={circle,minimum height=0.6cm, 
text width=4.5em, text badly centered, node distance=3cm, inner sep=0pt, outer sep=1mm},
sun/.style={sunEmpty,draw,fill=UiT-orange},
block/.style={rectangle, draw, fill=green!20,
text width=20em, text centered, minimum height=4em, outer sep=1mm},
line/.style={-latex, line width=1.8mm, draw=blue!40}}

\begin{document}
\begin{tikzpicture}[node distance = 2cm, auto]
% Place nodes
\node [sun] (Sun) {Sun};
\node [sunEmpty,right of=Sun] (SunEmpty) {};
\node [block, right of=Sun, yshift=-2cm] (greenhouse) {Greenhouse layer};
\node [block, fill=black!20, below of=greenhouse, yshift=-2cm] (surface) {surface};
% Draw edges  
\path [line,UiT-orange] (Sun) -- (surface.north-|Sun);
\path [line] (surface) -- (greenhouse);
\path [line] (greenhouse.north-|SunEmpty) -- (SunEmpty.north);
\end{tikzpicture}
\end{document}

편집 - 더 나은 버전(덕분에사용자121799)

\documentclass[margin=3mm,tikz]{standalone} 
\usetikzlibrary{shapes.arrows,calc,shadows.blur,positioning}
\definecolor{UiT-main}{HTML}{003349}
\definecolor{UiT-red}{HTML}{CB333B}
\definecolor{UiT-blue}{HTML}{007396}
\definecolor{UiT-cyan}{HTML}{59BEC9}
\definecolor{UiT-orange}{HTML}{F2A900}

% Define block styles
\tikzset{sun/.style={circle,minimum height=0.6cm, draw, fill=UiT-orange, 
text width=4.5em, text badly centered, node distance=3cm, inner sep=0pt, outer
sep=1mm},
sunEmpty/.style={circle,minimum height=0.6cm, 
text width=4.5em, text badly centered, node distance=3cm, inner sep=0pt, outer
sep=1mm},
block/.style={rectangle, draw, fill=green!20, 
text width=20em, text centered, minimum height=4em, outer sep=1mm},
line/.style={-latex, double arrow, line width=1.8mm, draw=blue!40}}

\begin{document}
\begin{tikzpicture}[node distance = 2cm, auto,
  fat arrow/.style={% https://tex.stackexchange.com/a/432147/121799
      to path={
        let \p1 = ($(\tikztotarget)-(\tikztostart)$),
            \n1 = {int(mod(scalar(atan2(\y1,\x1))+360, 360))}, % calculate angle in range [0,360)
            \n2 = {veclen(\x1,\y1)}
        in
        -- (\tikztotarget)
        node[inner xsep=0pt,inner ysep=5pt, % use inner ysep to set width
             minimum height=\n2-\pgflinewidth,
             single arrow,midway,sloped,anchor=center,
             #1          % arguments passed to fat arrow added here
             ] {} \tikztonodes}
  },
  fat arrow/.default=, % empty default for argument of fat arrow
  pft/.style={single arrow,draw=blue,blur
shadow,xshift=-2pt,minimum width=10mm, single arrow head extend=.2cm }
]
% Place nodes
\node [sun,blur shadow] (Sun) {Sun};
\node [sunEmpty,right=2.2cm of Sun] (SunEmpty) {};
\node [block, right of=Sun, yshift=-2cm,blur shadow,rounded corners=2pt] (greenhouse) {Greenhouse layer};
\node [block, fill=black!20, below of=greenhouse, yshift=-2cm,blur shadow,rounded corners=2pt] (surface) {surface};
% Draw edges  
\path [fat arrow={pft,top color=UiT-orange!80,bottom color=UiT-orange}]
(Sun.south) to (surface.north-|Sun) ;
\path [fat arrow={pft,top color=blue!20,bottom color=blue!40}]
(surface.north) to (greenhouse.south);
\path [fat arrow={pft,top color=blue!20,bottom color=blue!40,minimum width=5mm}]
(greenhouse.north-|SunEmpty) to (SunEmpty.north);
\path [fat arrow={pft,top color=blue!20,bottom color=blue!40,minimum width=5mm}]
(greenhouse.south-|SunEmpty) to (surface.north-|SunEmpty);
\end{tikzpicture}
\end{document}

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

관련 정보