How to draw a diagram like this with tikz?Rotate a node but not its content: the case of the ellipse...

Where to connect the fuse and why?

Journal standards vs. personal standards

Russian equivalents of 能骗就骗 (if you can cheat, then cheat)

Is it theoretically possible to hack printer using scanner tray?

What does 'in attendance' mean on an England death certificate?

A* pathfinding algorithm too slow

What are the advantages and disadvantages of Manhattan-Style routing?

What was the first science fiction or fantasy multiple choice book?

Why isn't UDP with reliability (implemented at Application layer) a substitute of TCP?

Do electrons really perform instantaneous quantum leaps?

German idiomatic equivalents of 能骗就骗 (if you can cheat, then cheat)

Why do some PCBs have exposed plated perimeters?

Word ending in "-ine" for rat-like

Why did the Apple //e make a hideous noise if you inserted the disk upside down?

Why doesn't SpaceX land boosters in Africa?

Why is exile often an intermediate step?

English idiomatic equivalents of 能骗就骗 (if you can cheat, then cheat)

Why are symbols not written in words?

Automorphisms and epimorphisms of finite groups

Would skyscrapers tip over if people fell sideways?

Where can I find my serialized Sitecore items?

Early 2000s movie about time travel, protagonist travels back to save girlfriend, then into multiple points in future

Is leaving out prefixes like "rauf", "rüber", "rein" when describing movement considered a big mistake in spoken German?

Reusable spacecraft: why still have fairings detach, instead of open/close?



How to draw a diagram like this with tikz?


Rotate a node but not its content: the case of the ellipse decorationHow to evenly space out nodes or in tikz?How to define the default vertical distance between nodes?Add text on arrow in flowchartInput/Output Nodes - Specification and Description LanguageTikz: Lining up input and output nodes in multiple input multiple output diagramText alignment and form of connectors (edges) in tikz treeDrawing rectilinear curves in Tikz, aka an Etch-a-Sketch drawingLine up nested tikz enviroments or how to get rid of themThe order of execution of options (draw & font), pgfextra, and a node along a TikZ path













1















I know this is a shit question, but I don't know what to do because I don't have much time left.



I need a diagram like this for my thesis:
diagram example



I already tried making this with tikz. First I tried it with the libraries shapes and arrows on my own with node and path, but I couldn't do it.
Then I tried it with the trees library, but it also didn't work out how I wanted.
Now I need you help. I guess it's just a few lines of code.



Here is the code of my best attempt so far



documentclass[a4,border=10pt]{article}
usepackage{tikz}
usetikzlibrary{shapes,arrows}

begin{document}
% Define block styles
tikzstyle{decision} = [diamond, draw, fill=blue!20,
text width=4.5em, text badly centered, node distance=3cm, inner sep=0pt]
tikzstyle{block} = [rectangle, draw, fill=blue!20,
text width=5em, text centered, minimum height=4em]
tikzstyle{line} = [draw, -latex']

begin{tikzpicture}[node distance = 2cm, auto]
% Place nodes
node [decision] (outsideThreat) {Bedrohung von außen?};
node [block, left of=outsideThreat, below of=outsideThreat] (firewall) {Firewall};
node [decision, right of=outsideThreat, below of=outsideThreat] (knownThreat) {Bedrohung bekannt?};
node [block, below of=knownThreat, left of=knownThreat] (idsAds) {IDS/ADS};
node [block, below of=knownThreat, right of=knownThreat] (honeypots) {Honeypots};
% Draw edges
path [line] (outsideThreat) --(outsideThreat-|firewall) -- node {yes} (firewall);
path [line] (outsideThreat) --(knownThreat|-outsideThreat) -- node {no} (knownThreat);
path [line] (firewall) -- (knownThreat);
path [line] (knownThreat) --(knownThreat-|idsAds) -- node {yes} (idsAds);
path [line] (knownThreat) --(honeypots|-knownThreat) -- node {no} (honeypots);
end{tikzpicture}
end{document}


This code produces this output:
enter image description here



I can't manage to get the Firewall block and the Bedrohung bekannt? decision on the same level horizontally. And don't know how to achieve the exact arrows of my example above.










share|improve this question









New contributor



LaTeXNoob is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • Could you post the code of your best attempt? It may not quite work, but it would give us something to start from.

    – Teepeemm
    8 hours ago











  • @Teepeemm Of course, will post it below as answer.

    – LaTeXNoob
    8 hours ago













  • Thanks for that (although it would have been better to edit this post and put the code here - we're somewhat strict about only answers going in the answer area).

    – Teepeemm
    8 hours ago
















1















I know this is a shit question, but I don't know what to do because I don't have much time left.



I need a diagram like this for my thesis:
diagram example



I already tried making this with tikz. First I tried it with the libraries shapes and arrows on my own with node and path, but I couldn't do it.
Then I tried it with the trees library, but it also didn't work out how I wanted.
Now I need you help. I guess it's just a few lines of code.



Here is the code of my best attempt so far



documentclass[a4,border=10pt]{article}
usepackage{tikz}
usetikzlibrary{shapes,arrows}

begin{document}
% Define block styles
tikzstyle{decision} = [diamond, draw, fill=blue!20,
text width=4.5em, text badly centered, node distance=3cm, inner sep=0pt]
tikzstyle{block} = [rectangle, draw, fill=blue!20,
text width=5em, text centered, minimum height=4em]
tikzstyle{line} = [draw, -latex']

begin{tikzpicture}[node distance = 2cm, auto]
% Place nodes
node [decision] (outsideThreat) {Bedrohung von außen?};
node [block, left of=outsideThreat, below of=outsideThreat] (firewall) {Firewall};
node [decision, right of=outsideThreat, below of=outsideThreat] (knownThreat) {Bedrohung bekannt?};
node [block, below of=knownThreat, left of=knownThreat] (idsAds) {IDS/ADS};
node [block, below of=knownThreat, right of=knownThreat] (honeypots) {Honeypots};
% Draw edges
path [line] (outsideThreat) --(outsideThreat-|firewall) -- node {yes} (firewall);
path [line] (outsideThreat) --(knownThreat|-outsideThreat) -- node {no} (knownThreat);
path [line] (firewall) -- (knownThreat);
path [line] (knownThreat) --(knownThreat-|idsAds) -- node {yes} (idsAds);
path [line] (knownThreat) --(honeypots|-knownThreat) -- node {no} (honeypots);
end{tikzpicture}
end{document}


This code produces this output:
enter image description here



I can't manage to get the Firewall block and the Bedrohung bekannt? decision on the same level horizontally. And don't know how to achieve the exact arrows of my example above.










share|improve this question









New contributor



LaTeXNoob is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • Could you post the code of your best attempt? It may not quite work, but it would give us something to start from.

    – Teepeemm
    8 hours ago











  • @Teepeemm Of course, will post it below as answer.

    – LaTeXNoob
    8 hours ago













  • Thanks for that (although it would have been better to edit this post and put the code here - we're somewhat strict about only answers going in the answer area).

    – Teepeemm
    8 hours ago














1












1








1


0






I know this is a shit question, but I don't know what to do because I don't have much time left.



I need a diagram like this for my thesis:
diagram example



I already tried making this with tikz. First I tried it with the libraries shapes and arrows on my own with node and path, but I couldn't do it.
Then I tried it with the trees library, but it also didn't work out how I wanted.
Now I need you help. I guess it's just a few lines of code.



Here is the code of my best attempt so far



documentclass[a4,border=10pt]{article}
usepackage{tikz}
usetikzlibrary{shapes,arrows}

begin{document}
% Define block styles
tikzstyle{decision} = [diamond, draw, fill=blue!20,
text width=4.5em, text badly centered, node distance=3cm, inner sep=0pt]
tikzstyle{block} = [rectangle, draw, fill=blue!20,
text width=5em, text centered, minimum height=4em]
tikzstyle{line} = [draw, -latex']

begin{tikzpicture}[node distance = 2cm, auto]
% Place nodes
node [decision] (outsideThreat) {Bedrohung von außen?};
node [block, left of=outsideThreat, below of=outsideThreat] (firewall) {Firewall};
node [decision, right of=outsideThreat, below of=outsideThreat] (knownThreat) {Bedrohung bekannt?};
node [block, below of=knownThreat, left of=knownThreat] (idsAds) {IDS/ADS};
node [block, below of=knownThreat, right of=knownThreat] (honeypots) {Honeypots};
% Draw edges
path [line] (outsideThreat) --(outsideThreat-|firewall) -- node {yes} (firewall);
path [line] (outsideThreat) --(knownThreat|-outsideThreat) -- node {no} (knownThreat);
path [line] (firewall) -- (knownThreat);
path [line] (knownThreat) --(knownThreat-|idsAds) -- node {yes} (idsAds);
path [line] (knownThreat) --(honeypots|-knownThreat) -- node {no} (honeypots);
end{tikzpicture}
end{document}


This code produces this output:
enter image description here



I can't manage to get the Firewall block and the Bedrohung bekannt? decision on the same level horizontally. And don't know how to achieve the exact arrows of my example above.










share|improve this question









New contributor



LaTeXNoob is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











I know this is a shit question, but I don't know what to do because I don't have much time left.



I need a diagram like this for my thesis:
diagram example



I already tried making this with tikz. First I tried it with the libraries shapes and arrows on my own with node and path, but I couldn't do it.
Then I tried it with the trees library, but it also didn't work out how I wanted.
Now I need you help. I guess it's just a few lines of code.



Here is the code of my best attempt so far



documentclass[a4,border=10pt]{article}
usepackage{tikz}
usetikzlibrary{shapes,arrows}

begin{document}
% Define block styles
tikzstyle{decision} = [diamond, draw, fill=blue!20,
text width=4.5em, text badly centered, node distance=3cm, inner sep=0pt]
tikzstyle{block} = [rectangle, draw, fill=blue!20,
text width=5em, text centered, minimum height=4em]
tikzstyle{line} = [draw, -latex']

begin{tikzpicture}[node distance = 2cm, auto]
% Place nodes
node [decision] (outsideThreat) {Bedrohung von außen?};
node [block, left of=outsideThreat, below of=outsideThreat] (firewall) {Firewall};
node [decision, right of=outsideThreat, below of=outsideThreat] (knownThreat) {Bedrohung bekannt?};
node [block, below of=knownThreat, left of=knownThreat] (idsAds) {IDS/ADS};
node [block, below of=knownThreat, right of=knownThreat] (honeypots) {Honeypots};
% Draw edges
path [line] (outsideThreat) --(outsideThreat-|firewall) -- node {yes} (firewall);
path [line] (outsideThreat) --(knownThreat|-outsideThreat) -- node {no} (knownThreat);
path [line] (firewall) -- (knownThreat);
path [line] (knownThreat) --(knownThreat-|idsAds) -- node {yes} (idsAds);
path [line] (knownThreat) --(honeypots|-knownThreat) -- node {no} (honeypots);
end{tikzpicture}
end{document}


This code produces this output:
enter image description here



I can't manage to get the Firewall block and the Bedrohung bekannt? decision on the same level horizontally. And don't know how to achieve the exact arrows of my example above.







tikz-pgf tikz-trees






share|improve this question









New contributor



LaTeXNoob is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.










share|improve this question









New contributor



LaTeXNoob is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








share|improve this question




share|improve this question








edited 7 hours ago









Phelype Oleinik

30.7k7 gold badges52 silver badges105 bronze badges




30.7k7 gold badges52 silver badges105 bronze badges






New contributor



LaTeXNoob is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








asked 8 hours ago









LaTeXNoobLaTeXNoob

61 bronze badge




61 bronze badge




New contributor



LaTeXNoob is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




New contributor




LaTeXNoob is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.















  • Could you post the code of your best attempt? It may not quite work, but it would give us something to start from.

    – Teepeemm
    8 hours ago











  • @Teepeemm Of course, will post it below as answer.

    – LaTeXNoob
    8 hours ago













  • Thanks for that (although it would have been better to edit this post and put the code here - we're somewhat strict about only answers going in the answer area).

    – Teepeemm
    8 hours ago



















  • Could you post the code of your best attempt? It may not quite work, but it would give us something to start from.

    – Teepeemm
    8 hours ago











  • @Teepeemm Of course, will post it below as answer.

    – LaTeXNoob
    8 hours ago













  • Thanks for that (although it would have been better to edit this post and put the code here - we're somewhat strict about only answers going in the answer area).

    – Teepeemm
    8 hours ago

















Could you post the code of your best attempt? It may not quite work, but it would give us something to start from.

– Teepeemm
8 hours ago





Could you post the code of your best attempt? It may not quite work, but it would give us something to start from.

– Teepeemm
8 hours ago













@Teepeemm Of course, will post it below as answer.

– LaTeXNoob
8 hours ago







@Teepeemm Of course, will post it below as answer.

– LaTeXNoob
8 hours ago















Thanks for that (although it would have been better to edit this post and put the code here - we're somewhat strict about only answers going in the answer area).

– Teepeemm
8 hours ago





Thanks for that (although it would have been better to edit this post and put the code here - we're somewhat strict about only answers going in the answer area).

– Teepeemm
8 hours ago










3 Answers
3






active

oldest

votes


















4














Here is one way!



documentclass[tikz,border=3mm]{standalone}
usetikzlibrary{shapes.geometric}
begin{document}
begin{tikzpicture}[thick,>=stealth]
tikzset{box/.style=
{draw,minimum height=1.2cm,minimum width=3cm}}
path
(0,2) node[diamond,draw] (d1) {decision1}
(-5,-2) node[box] (b1) {block1}
(4,-2) node[diamond,draw] (d2) {decision2}
++(-90:1.5) coordinate (d2s) {}
+(4,-2) node[box] (b3) {block3}
+(-3,-1.5) node[box] (b4) {block4};
draw (0,0)--(d1);
draw[->] (0,0)-|(d2) node[pos=.25,above]{no};
draw[->] (0,0)-|(b1) node[pos=.25,above]{yes};
draw[->] (b1)--(d2) node[midway,above]{some condition};
draw (d2)--(d2s);
draw[->] (d2s)-|(b3) node[pos=.25,above]{no};
draw[->] (d2s)-|(b4) node[pos=.25,above]{yes};
end{tikzpicture}
end{document}


enter image description here






share|improve this answer



















  • 1





    Good answer (+1). Can you align block4 and block3 horizontally?

    – ferahfeza
    7 hours ago











  • Yes thank you for that answer. @ferahfeza to align block4 and just change the y coordinate of block4 to be 2 (the same as block 3)

    – LaTeXNoob
    7 hours ago











  • @ferahfeza of course this okay, just change +(4,-2) node[box] (b3) {block3} +(-3,-1.5) node[box] (b4) {block4}; to +(4,-1.5) node[box] (b3) {block3} +(-3,-1.5) node[box] (b4) {block4};

    – Black Mild
    7 hours ago



















1














With forest you can automatize several things. In particular, you can leave the decision whether or not a node is a decision to forest.



documentclass[tikz,border=3.14mm]{standalone}
usepackage[edges]{forest}
usetikzlibrary{shapes.geometric}
begin{document}
begin{forest}
forked edges,
for tree={l sep=3em,s sep=3em,edge={-stealth},
where n children=2{diamond}{rectangle,inner sep=1ex},draw,
if n=1{edge label={node [pos=0.25, below] {yes} } }{edge label={node [pos=0.25, below] {no} } }}
[decision 1
[block 1,alias=b1]
[decision 2,alias=d2
[block 2]
[block 3]
]
]
draw[-stealth] (b1) -- (d2) node[midway,above]{pft};
end{forest}
end{document}


enter image description here






share|improve this answer































    1














    For fun, a simple pstricks code:



    documentclass[border=6pt]{standalone}%
    usepackage[utf8]{inputenc}
    usepackage[T1]{fontenc}
    usepackage{pst-node}
    newcommand{psstrut}{rule[-0.55cm]{0pt}{1.25cm}}
    newcommand{diastrut}{rule[-0.65cm]{0pt}{1.45cm}}%

    begin{document}

    {sffamilyeverymath{displaystyle}%
    psset{framesep=1pt, arrows=->, arrowinset=0.1,linejoin=1}
    begin{psmatrix}[rowsep=2.5cm, colsep=2cm, emnode=r]%
    %%% Nodes
    & dianode[framesep = -2pt]{d1}{{diastrut Decision 1}}\
    [name=b1] psframebox{makebox[2.5cm]{psstrut block 1}} & & dianode[framesep = -2pt]{d2}{{diastrut Decision 2}}\
    & [name=b2] psframebox{makebox[2.5cm]{psstrut block 2}} & & [name=b3] psframebox{makebox[2.5cm]{psstrut block 3}}
    %%% Node connections
    psset{angleA=-90, angleB=90, armA=0.8cm, armB=0.8cm, labelsep=2pt}
    ncangles{d1}{b1}nbput{yes}
    ncangles{d1}{d2}naput{no}
    ncline{b1}{d2}naput{some condition}
    ncangles{d2}{b2}nbput{yes}
    ncangles{d2}{b3}naput{no}
    end{psmatrix}}

    end{document}


    enter image description here






    share|improve this answer


























      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "85"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });






      LaTeXNoob is a new contributor. Be nice, and check out our Code of Conduct.










      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f497864%2fhow-to-draw-a-diagram-like-this-with-tikz%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      4














      Here is one way!



      documentclass[tikz,border=3mm]{standalone}
      usetikzlibrary{shapes.geometric}
      begin{document}
      begin{tikzpicture}[thick,>=stealth]
      tikzset{box/.style=
      {draw,minimum height=1.2cm,minimum width=3cm}}
      path
      (0,2) node[diamond,draw] (d1) {decision1}
      (-5,-2) node[box] (b1) {block1}
      (4,-2) node[diamond,draw] (d2) {decision2}
      ++(-90:1.5) coordinate (d2s) {}
      +(4,-2) node[box] (b3) {block3}
      +(-3,-1.5) node[box] (b4) {block4};
      draw (0,0)--(d1);
      draw[->] (0,0)-|(d2) node[pos=.25,above]{no};
      draw[->] (0,0)-|(b1) node[pos=.25,above]{yes};
      draw[->] (b1)--(d2) node[midway,above]{some condition};
      draw (d2)--(d2s);
      draw[->] (d2s)-|(b3) node[pos=.25,above]{no};
      draw[->] (d2s)-|(b4) node[pos=.25,above]{yes};
      end{tikzpicture}
      end{document}


      enter image description here






      share|improve this answer



















      • 1





        Good answer (+1). Can you align block4 and block3 horizontally?

        – ferahfeza
        7 hours ago











      • Yes thank you for that answer. @ferahfeza to align block4 and just change the y coordinate of block4 to be 2 (the same as block 3)

        – LaTeXNoob
        7 hours ago











      • @ferahfeza of course this okay, just change +(4,-2) node[box] (b3) {block3} +(-3,-1.5) node[box] (b4) {block4}; to +(4,-1.5) node[box] (b3) {block3} +(-3,-1.5) node[box] (b4) {block4};

        – Black Mild
        7 hours ago
















      4














      Here is one way!



      documentclass[tikz,border=3mm]{standalone}
      usetikzlibrary{shapes.geometric}
      begin{document}
      begin{tikzpicture}[thick,>=stealth]
      tikzset{box/.style=
      {draw,minimum height=1.2cm,minimum width=3cm}}
      path
      (0,2) node[diamond,draw] (d1) {decision1}
      (-5,-2) node[box] (b1) {block1}
      (4,-2) node[diamond,draw] (d2) {decision2}
      ++(-90:1.5) coordinate (d2s) {}
      +(4,-2) node[box] (b3) {block3}
      +(-3,-1.5) node[box] (b4) {block4};
      draw (0,0)--(d1);
      draw[->] (0,0)-|(d2) node[pos=.25,above]{no};
      draw[->] (0,0)-|(b1) node[pos=.25,above]{yes};
      draw[->] (b1)--(d2) node[midway,above]{some condition};
      draw (d2)--(d2s);
      draw[->] (d2s)-|(b3) node[pos=.25,above]{no};
      draw[->] (d2s)-|(b4) node[pos=.25,above]{yes};
      end{tikzpicture}
      end{document}


      enter image description here






      share|improve this answer



















      • 1





        Good answer (+1). Can you align block4 and block3 horizontally?

        – ferahfeza
        7 hours ago











      • Yes thank you for that answer. @ferahfeza to align block4 and just change the y coordinate of block4 to be 2 (the same as block 3)

        – LaTeXNoob
        7 hours ago











      • @ferahfeza of course this okay, just change +(4,-2) node[box] (b3) {block3} +(-3,-1.5) node[box] (b4) {block4}; to +(4,-1.5) node[box] (b3) {block3} +(-3,-1.5) node[box] (b4) {block4};

        – Black Mild
        7 hours ago














      4












      4








      4







      Here is one way!



      documentclass[tikz,border=3mm]{standalone}
      usetikzlibrary{shapes.geometric}
      begin{document}
      begin{tikzpicture}[thick,>=stealth]
      tikzset{box/.style=
      {draw,minimum height=1.2cm,minimum width=3cm}}
      path
      (0,2) node[diamond,draw] (d1) {decision1}
      (-5,-2) node[box] (b1) {block1}
      (4,-2) node[diamond,draw] (d2) {decision2}
      ++(-90:1.5) coordinate (d2s) {}
      +(4,-2) node[box] (b3) {block3}
      +(-3,-1.5) node[box] (b4) {block4};
      draw (0,0)--(d1);
      draw[->] (0,0)-|(d2) node[pos=.25,above]{no};
      draw[->] (0,0)-|(b1) node[pos=.25,above]{yes};
      draw[->] (b1)--(d2) node[midway,above]{some condition};
      draw (d2)--(d2s);
      draw[->] (d2s)-|(b3) node[pos=.25,above]{no};
      draw[->] (d2s)-|(b4) node[pos=.25,above]{yes};
      end{tikzpicture}
      end{document}


      enter image description here






      share|improve this answer













      Here is one way!



      documentclass[tikz,border=3mm]{standalone}
      usetikzlibrary{shapes.geometric}
      begin{document}
      begin{tikzpicture}[thick,>=stealth]
      tikzset{box/.style=
      {draw,minimum height=1.2cm,minimum width=3cm}}
      path
      (0,2) node[diamond,draw] (d1) {decision1}
      (-5,-2) node[box] (b1) {block1}
      (4,-2) node[diamond,draw] (d2) {decision2}
      ++(-90:1.5) coordinate (d2s) {}
      +(4,-2) node[box] (b3) {block3}
      +(-3,-1.5) node[box] (b4) {block4};
      draw (0,0)--(d1);
      draw[->] (0,0)-|(d2) node[pos=.25,above]{no};
      draw[->] (0,0)-|(b1) node[pos=.25,above]{yes};
      draw[->] (b1)--(d2) node[midway,above]{some condition};
      draw (d2)--(d2s);
      draw[->] (d2s)-|(b3) node[pos=.25,above]{no};
      draw[->] (d2s)-|(b4) node[pos=.25,above]{yes};
      end{tikzpicture}
      end{document}


      enter image description here







      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered 8 hours ago









      Black MildBlack Mild

      1,0087 silver badges12 bronze badges




      1,0087 silver badges12 bronze badges








      • 1





        Good answer (+1). Can you align block4 and block3 horizontally?

        – ferahfeza
        7 hours ago











      • Yes thank you for that answer. @ferahfeza to align block4 and just change the y coordinate of block4 to be 2 (the same as block 3)

        – LaTeXNoob
        7 hours ago











      • @ferahfeza of course this okay, just change +(4,-2) node[box] (b3) {block3} +(-3,-1.5) node[box] (b4) {block4}; to +(4,-1.5) node[box] (b3) {block3} +(-3,-1.5) node[box] (b4) {block4};

        – Black Mild
        7 hours ago














      • 1





        Good answer (+1). Can you align block4 and block3 horizontally?

        – ferahfeza
        7 hours ago











      • Yes thank you for that answer. @ferahfeza to align block4 and just change the y coordinate of block4 to be 2 (the same as block 3)

        – LaTeXNoob
        7 hours ago











      • @ferahfeza of course this okay, just change +(4,-2) node[box] (b3) {block3} +(-3,-1.5) node[box] (b4) {block4}; to +(4,-1.5) node[box] (b3) {block3} +(-3,-1.5) node[box] (b4) {block4};

        – Black Mild
        7 hours ago








      1




      1





      Good answer (+1). Can you align block4 and block3 horizontally?

      – ferahfeza
      7 hours ago





      Good answer (+1). Can you align block4 and block3 horizontally?

      – ferahfeza
      7 hours ago













      Yes thank you for that answer. @ferahfeza to align block4 and just change the y coordinate of block4 to be 2 (the same as block 3)

      – LaTeXNoob
      7 hours ago





      Yes thank you for that answer. @ferahfeza to align block4 and just change the y coordinate of block4 to be 2 (the same as block 3)

      – LaTeXNoob
      7 hours ago













      @ferahfeza of course this okay, just change +(4,-2) node[box] (b3) {block3} +(-3,-1.5) node[box] (b4) {block4}; to +(4,-1.5) node[box] (b3) {block3} +(-3,-1.5) node[box] (b4) {block4};

      – Black Mild
      7 hours ago





      @ferahfeza of course this okay, just change +(4,-2) node[box] (b3) {block3} +(-3,-1.5) node[box] (b4) {block4}; to +(4,-1.5) node[box] (b3) {block3} +(-3,-1.5) node[box] (b4) {block4};

      – Black Mild
      7 hours ago











      1














      With forest you can automatize several things. In particular, you can leave the decision whether or not a node is a decision to forest.



      documentclass[tikz,border=3.14mm]{standalone}
      usepackage[edges]{forest}
      usetikzlibrary{shapes.geometric}
      begin{document}
      begin{forest}
      forked edges,
      for tree={l sep=3em,s sep=3em,edge={-stealth},
      where n children=2{diamond}{rectangle,inner sep=1ex},draw,
      if n=1{edge label={node [pos=0.25, below] {yes} } }{edge label={node [pos=0.25, below] {no} } }}
      [decision 1
      [block 1,alias=b1]
      [decision 2,alias=d2
      [block 2]
      [block 3]
      ]
      ]
      draw[-stealth] (b1) -- (d2) node[midway,above]{pft};
      end{forest}
      end{document}


      enter image description here






      share|improve this answer




























        1














        With forest you can automatize several things. In particular, you can leave the decision whether or not a node is a decision to forest.



        documentclass[tikz,border=3.14mm]{standalone}
        usepackage[edges]{forest}
        usetikzlibrary{shapes.geometric}
        begin{document}
        begin{forest}
        forked edges,
        for tree={l sep=3em,s sep=3em,edge={-stealth},
        where n children=2{diamond}{rectangle,inner sep=1ex},draw,
        if n=1{edge label={node [pos=0.25, below] {yes} } }{edge label={node [pos=0.25, below] {no} } }}
        [decision 1
        [block 1,alias=b1]
        [decision 2,alias=d2
        [block 2]
        [block 3]
        ]
        ]
        draw[-stealth] (b1) -- (d2) node[midway,above]{pft};
        end{forest}
        end{document}


        enter image description here






        share|improve this answer


























          1












          1








          1







          With forest you can automatize several things. In particular, you can leave the decision whether or not a node is a decision to forest.



          documentclass[tikz,border=3.14mm]{standalone}
          usepackage[edges]{forest}
          usetikzlibrary{shapes.geometric}
          begin{document}
          begin{forest}
          forked edges,
          for tree={l sep=3em,s sep=3em,edge={-stealth},
          where n children=2{diamond}{rectangle,inner sep=1ex},draw,
          if n=1{edge label={node [pos=0.25, below] {yes} } }{edge label={node [pos=0.25, below] {no} } }}
          [decision 1
          [block 1,alias=b1]
          [decision 2,alias=d2
          [block 2]
          [block 3]
          ]
          ]
          draw[-stealth] (b1) -- (d2) node[midway,above]{pft};
          end{forest}
          end{document}


          enter image description here






          share|improve this answer













          With forest you can automatize several things. In particular, you can leave the decision whether or not a node is a decision to forest.



          documentclass[tikz,border=3.14mm]{standalone}
          usepackage[edges]{forest}
          usetikzlibrary{shapes.geometric}
          begin{document}
          begin{forest}
          forked edges,
          for tree={l sep=3em,s sep=3em,edge={-stealth},
          where n children=2{diamond}{rectangle,inner sep=1ex},draw,
          if n=1{edge label={node [pos=0.25, below] {yes} } }{edge label={node [pos=0.25, below] {no} } }}
          [decision 1
          [block 1,alias=b1]
          [decision 2,alias=d2
          [block 2]
          [block 3]
          ]
          ]
          draw[-stealth] (b1) -- (d2) node[midway,above]{pft};
          end{forest}
          end{document}


          enter image description here







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 7 hours ago









          marmotmarmot

          140k6 gold badges184 silver badges338 bronze badges




          140k6 gold badges184 silver badges338 bronze badges























              1














              For fun, a simple pstricks code:



              documentclass[border=6pt]{standalone}%
              usepackage[utf8]{inputenc}
              usepackage[T1]{fontenc}
              usepackage{pst-node}
              newcommand{psstrut}{rule[-0.55cm]{0pt}{1.25cm}}
              newcommand{diastrut}{rule[-0.65cm]{0pt}{1.45cm}}%

              begin{document}

              {sffamilyeverymath{displaystyle}%
              psset{framesep=1pt, arrows=->, arrowinset=0.1,linejoin=1}
              begin{psmatrix}[rowsep=2.5cm, colsep=2cm, emnode=r]%
              %%% Nodes
              & dianode[framesep = -2pt]{d1}{{diastrut Decision 1}}\
              [name=b1] psframebox{makebox[2.5cm]{psstrut block 1}} & & dianode[framesep = -2pt]{d2}{{diastrut Decision 2}}\
              & [name=b2] psframebox{makebox[2.5cm]{psstrut block 2}} & & [name=b3] psframebox{makebox[2.5cm]{psstrut block 3}}
              %%% Node connections
              psset{angleA=-90, angleB=90, armA=0.8cm, armB=0.8cm, labelsep=2pt}
              ncangles{d1}{b1}nbput{yes}
              ncangles{d1}{d2}naput{no}
              ncline{b1}{d2}naput{some condition}
              ncangles{d2}{b2}nbput{yes}
              ncangles{d2}{b3}naput{no}
              end{psmatrix}}

              end{document}


              enter image description here






              share|improve this answer




























                1














                For fun, a simple pstricks code:



                documentclass[border=6pt]{standalone}%
                usepackage[utf8]{inputenc}
                usepackage[T1]{fontenc}
                usepackage{pst-node}
                newcommand{psstrut}{rule[-0.55cm]{0pt}{1.25cm}}
                newcommand{diastrut}{rule[-0.65cm]{0pt}{1.45cm}}%

                begin{document}

                {sffamilyeverymath{displaystyle}%
                psset{framesep=1pt, arrows=->, arrowinset=0.1,linejoin=1}
                begin{psmatrix}[rowsep=2.5cm, colsep=2cm, emnode=r]%
                %%% Nodes
                & dianode[framesep = -2pt]{d1}{{diastrut Decision 1}}\
                [name=b1] psframebox{makebox[2.5cm]{psstrut block 1}} & & dianode[framesep = -2pt]{d2}{{diastrut Decision 2}}\
                & [name=b2] psframebox{makebox[2.5cm]{psstrut block 2}} & & [name=b3] psframebox{makebox[2.5cm]{psstrut block 3}}
                %%% Node connections
                psset{angleA=-90, angleB=90, armA=0.8cm, armB=0.8cm, labelsep=2pt}
                ncangles{d1}{b1}nbput{yes}
                ncangles{d1}{d2}naput{no}
                ncline{b1}{d2}naput{some condition}
                ncangles{d2}{b2}nbput{yes}
                ncangles{d2}{b3}naput{no}
                end{psmatrix}}

                end{document}


                enter image description here






                share|improve this answer


























                  1












                  1








                  1







                  For fun, a simple pstricks code:



                  documentclass[border=6pt]{standalone}%
                  usepackage[utf8]{inputenc}
                  usepackage[T1]{fontenc}
                  usepackage{pst-node}
                  newcommand{psstrut}{rule[-0.55cm]{0pt}{1.25cm}}
                  newcommand{diastrut}{rule[-0.65cm]{0pt}{1.45cm}}%

                  begin{document}

                  {sffamilyeverymath{displaystyle}%
                  psset{framesep=1pt, arrows=->, arrowinset=0.1,linejoin=1}
                  begin{psmatrix}[rowsep=2.5cm, colsep=2cm, emnode=r]%
                  %%% Nodes
                  & dianode[framesep = -2pt]{d1}{{diastrut Decision 1}}\
                  [name=b1] psframebox{makebox[2.5cm]{psstrut block 1}} & & dianode[framesep = -2pt]{d2}{{diastrut Decision 2}}\
                  & [name=b2] psframebox{makebox[2.5cm]{psstrut block 2}} & & [name=b3] psframebox{makebox[2.5cm]{psstrut block 3}}
                  %%% Node connections
                  psset{angleA=-90, angleB=90, armA=0.8cm, armB=0.8cm, labelsep=2pt}
                  ncangles{d1}{b1}nbput{yes}
                  ncangles{d1}{d2}naput{no}
                  ncline{b1}{d2}naput{some condition}
                  ncangles{d2}{b2}nbput{yes}
                  ncangles{d2}{b3}naput{no}
                  end{psmatrix}}

                  end{document}


                  enter image description here






                  share|improve this answer













                  For fun, a simple pstricks code:



                  documentclass[border=6pt]{standalone}%
                  usepackage[utf8]{inputenc}
                  usepackage[T1]{fontenc}
                  usepackage{pst-node}
                  newcommand{psstrut}{rule[-0.55cm]{0pt}{1.25cm}}
                  newcommand{diastrut}{rule[-0.65cm]{0pt}{1.45cm}}%

                  begin{document}

                  {sffamilyeverymath{displaystyle}%
                  psset{framesep=1pt, arrows=->, arrowinset=0.1,linejoin=1}
                  begin{psmatrix}[rowsep=2.5cm, colsep=2cm, emnode=r]%
                  %%% Nodes
                  & dianode[framesep = -2pt]{d1}{{diastrut Decision 1}}\
                  [name=b1] psframebox{makebox[2.5cm]{psstrut block 1}} & & dianode[framesep = -2pt]{d2}{{diastrut Decision 2}}\
                  & [name=b2] psframebox{makebox[2.5cm]{psstrut block 2}} & & [name=b3] psframebox{makebox[2.5cm]{psstrut block 3}}
                  %%% Node connections
                  psset{angleA=-90, angleB=90, armA=0.8cm, armB=0.8cm, labelsep=2pt}
                  ncangles{d1}{b1}nbput{yes}
                  ncangles{d1}{d2}naput{no}
                  ncline{b1}{d2}naput{some condition}
                  ncangles{d2}{b2}nbput{yes}
                  ncangles{d2}{b3}naput{no}
                  end{psmatrix}}

                  end{document}


                  enter image description here







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered 7 hours ago









                  BernardBernard

                  182k7 gold badges83 silver badges216 bronze badges




                  182k7 gold badges83 silver badges216 bronze badges






















                      LaTeXNoob is a new contributor. Be nice, and check out our Code of Conduct.










                      draft saved

                      draft discarded


















                      LaTeXNoob is a new contributor. Be nice, and check out our Code of Conduct.













                      LaTeXNoob is a new contributor. Be nice, and check out our Code of Conduct.












                      LaTeXNoob is a new contributor. Be nice, and check out our Code of Conduct.
















                      Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f497864%2fhow-to-draw-a-diagram-like-this-with-tikz%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Taj Mahal Inhaltsverzeichnis Aufbau | Geschichte | 350-Jahr-Feier | Heutige Bedeutung | Siehe auch |...

                      Baia Sprie Cuprins Etimologie | Istorie | Demografie | Politică și administrație | Arii naturale...

                      Ciclooctatetraenă Vezi și | Bibliografie | Meniu de navigare637866text4148569-500570979m