在流程图中添加黑点和小箭头

在流程图中添加黑点和小箭头

流程图

I'm trying to make this flow-chart, this is my code:

我修改了一下我的代码:

\begin{tikzpicture}[node distance=2cm, auto]
\tikzstyle{decision} = [diamond, text width=5.9em, text centered, draw=black, fill=blue!20, node distance=4cm]

\tikzstyle{startstop} = [rectangle, text width=7em, rounded corners, minimum height=1cm,text centered, draw=black, fill=white!20, node distance=3cm]

\tikzstyle{process} = [rectangle, text width=6em, text centered, draw=black, fill=white!20, node distance=3cm]

\tikzstyle{line} = [draw, -latex']

\centering
\node [startstop] (inizializza) {INIZIALIZZA MICRO};
\node [process, below of=inizializza] (identifica) {LEGGI PORTA DI INGRESSO};
\node [decision, below of=identifica] (decidi) {PULSANTE PREMUTO?};
\node [process, right of=decidi, node distance=4.5cm] (accendi) {ACCENDI LED};
\path [line] (inizializza) -- (identifica);
\path [line] (identifica) -- (decidi);
\path [line] (decidi) -- node {Si} (accendi);
\path [line] (decidi.south)  |- node[near start] {No} (0cm,-9.3)  -| (-2cm,-1.5)  -| (accendi);

\end{tikzpicture}

但仍然不知道如何在线条中添加黑点和其他小箭头

我有一个问题,让箭头向南、向左向北,然后回到“accendi led”,我不知道如何在线和黑点中插入那个小箭头。

答案1

新答案:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows,shapes,decorations.markings}

\begin{document}

\begin{tikzpicture}[node distance=2cm, auto]
\tikzstyle{decision} = [diamond, text width=5.9em, text centered, draw=black, fill=blue!20, node distance=4cm]

\tikzstyle{startstop} = [rectangle, text width=7em, rounded corners, minimum height=1cm,text centered, draw=black, fill=white!20, node distance=3cm]

\tikzstyle{process} = [rectangle, text width=6em, text centered, draw=black, fill=white!20, node distance=3cm]

\tikzstyle{line} = [draw, -latex']

\centering
\node [startstop] (inizializza) {INIZIALIZZA MICRO};
\node [process, below of=inizializza] (identifica) {LEGGI PORTA DI INGRESSO};
\node [decision, below of=identifica] (decidi) {PULSANTE PREMUTO?};
\node [process, right of=decidi, node distance=4.5cm] (accendi) {ACCENDI LED};
\begin{scope}[thick,decoration={
    markings,
    mark=at position 0.5 with {\arrow{>}}}]
\draw[->] (inizializza) -- (identifica);
\draw[->] (identifica) -- (decidi);
\draw[->] (decidi) -- node {si} (accendi);
\draw (decidi.south) --([yshift=-1cm]decidi.south);
\draw[postaction={decorate}] ([yshift=-1cm]decidi.south) node[right,yshift=0.5cm]{No}--([yshift=-1cm,xshift=-3cm]decidi.south);
\draw[postaction={decorate}] ([xshift=-3cm,yshift=-1cm]decidi.south)--([xshift=-3cm,yshift=6cm]decidi.center);
\draw ([xshift=-3cm,yshift=6cm]decidi.center)--([yshift=6cm]decidi.center);
\draw (accendi.east) --([xshift=1.2cm]accendi.east);
\draw[postaction={decorate}] ([xshift=1.2cm]accendi.east) --([xshift=1.2cm,yshift=6cm]accendi.east);
\draw([xshift=1.2cm,yshift=6cm]accendi.east)--([yshift=6cm]decidi.center);
\fill[black] ([yshift=6cm]decidi.center) circle (3pt);

\end{scope}
\end{tikzpicture}
\end{document}

输出:

在此处输入图片描述

旧答案: 尝试这样做:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows,shapes,decorations.markings}

\begin{document}

\begin{tikzpicture}[node distance=2cm, auto]
\tikzstyle{decision} = [diamond, text width=5.9em, text centered, draw=black, fill=blue!20, node distance=4cm]

\tikzstyle{startstop} = [rectangle, text width=7em, rounded corners, minimum height=1cm,text centered, draw=black, fill=white!20, node distance=3cm]

\tikzstyle{process} = [rectangle, text width=6em, text centered, draw=black, fill=white!20, node distance=3cm]

\tikzstyle{line} = [draw, -latex']

\centering
\node [startstop] (inizializza) {INIZIALIZZA MICRO};
\node [process, below of=inizializza] (identifica) {LEGGI PORTA DI INGRESSO};
\node [decision, below of=identifica] (decidi) {PULSANTE PREMUTO?};
\node [process, right of=decidi, node distance=4.5cm] (accendi) {ACCENDI LED};
\begin{scope}[thick,decoration={
    markings,
    mark=at position 0.5 with {\arrow{>}}}]
\draw[postaction={decorate}] (inizializza) -- (identifica);
\draw[postaction={decorate}] (identifica) -- (decidi);
\draw[postaction={decorate}] (decidi) -- node {si} (accendi);
\draw[postaction={decorate}] (decidi.west) --([xshift=-3cm]decidi.west);
\draw[postaction={decorate}] ([xshift=-3cm]decidi.west)--([xshift=-3cm,yshift=6cm]decidi.west);
\draw[postaction={decorate}] ([xshift=-3cm,yshift=6cm]decidi.west)--([yshift=6cm]decidi.center);
\draw[postaction={decorate}] (accendi.east) --([xshift=1.2cm]accendi.east);
\draw[postaction={decorate}] ([xshift=1.2cm]accendi.east) --([xshift=1.2cm,yshift=6cm]accendi.east);
\draw[postaction={decorate}]([xshift=1.2cm,yshift=6cm]accendi.east)--([yshift=6cm]decidi.center);
\fill[black] ([yshift=6cm]decidi.center) circle (3pt);
\end{scope}
\end{tikzpicture}
\end{document}

我用了这个答案:https://tex.stackexchange.com/a/3172/120578并且您的代码的图像结果-> 不是原始图像。如果您需要更多帮助,请更具体一些。

附言:我必须将线条分成几部分,以便将箭头放在每条线条的中间。

输出:

在此处输入图片描述

编辑:在标题中添加了您要求的点。

相关内容