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
How to track mail undetectably?
Grid: different background color (of row) based on values
Would skyscrapers tip over if people fell sideways?
Can I take Amul cottage cheese from India to Netherlands?
Journal standards vs. personal standards
What are the children of two Muggle-borns called?
What was the first science fiction or fantasy multiple choice book?
Tricolour nonogram
Is it possible to alias a column based on the result of a select+where?
Why should I allow multiple IPs on a website for a single session?
Dynamic Sql Query - how to add an int to the code?
Do electrons really perform instantaneous quantum leaps?
I agreed to cancel a long-planned vacation (with travel costs) due to project deadlines, but now the timeline has all changed again
What prevents a US state from colonizing a smaller state?
Did the Russian Empire have a claim to Sweden? Was there ever a time where they could have pursued it?
German idiomatic equivalents of 能骗就骗 (if you can cheat, then cheat)
How did they film the Invisible Man being invisible in 1933?
Active wildlife outside the window- Good or Bad for Cat psychology?
Why is my 401k manager recommending me to save more?
Robots in a spaceship
Subset of knight's move in chess.
What overwrites /etc/resolv.conf roughly every hour?
Installed software from source, how to say yum not to install it from package?
Avoiding repetition when using the "snprintf idiom" to write text
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
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:
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
usepackagetikz
usetikzlibraryshapes,arrows
begindocument
% Define block styles
tikzstyledecision = [diamond, draw, fill=blue!20,
text width=4.5em, text badly centered, node distance=3cm, inner sep=0pt]
tikzstyleblock = [rectangle, draw, fill=blue!20,
text width=5em, text centered, minimum height=4em]
tikzstyleline = [draw, -latex']
begintikzpicture[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);
endtikzpicture
enddocument
This code produces this output:
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
New contributor
add a comment |
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:
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
usepackagetikz
usetikzlibraryshapes,arrows
begindocument
% Define block styles
tikzstyledecision = [diamond, draw, fill=blue!20,
text width=4.5em, text badly centered, node distance=3cm, inner sep=0pt]
tikzstyleblock = [rectangle, draw, fill=blue!20,
text width=5em, text centered, minimum height=4em]
tikzstyleline = [draw, -latex']
begintikzpicture[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);
endtikzpicture
enddocument
This code produces this output:
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
New contributor
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
add a comment |
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:
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
usepackagetikz
usetikzlibraryshapes,arrows
begindocument
% Define block styles
tikzstyledecision = [diamond, draw, fill=blue!20,
text width=4.5em, text badly centered, node distance=3cm, inner sep=0pt]
tikzstyleblock = [rectangle, draw, fill=blue!20,
text width=5em, text centered, minimum height=4em]
tikzstyleline = [draw, -latex']
begintikzpicture[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);
endtikzpicture
enddocument
This code produces this output:
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
New contributor
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:
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
usepackagetikz
usetikzlibraryshapes,arrows
begindocument
% Define block styles
tikzstyledecision = [diamond, draw, fill=blue!20,
text width=4.5em, text badly centered, node distance=3cm, inner sep=0pt]
tikzstyleblock = [rectangle, draw, fill=blue!20,
text width=5em, text centered, minimum height=4em]
tikzstyleline = [draw, -latex']
begintikzpicture[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);
endtikzpicture
enddocument
This code produces this output:
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
tikz-pgf tikz-trees
New contributor
New contributor
edited 8 hours ago
Phelype Oleinik
30.7k7 gold badges52 silver badges105 bronze badges
30.7k7 gold badges52 silver badges105 bronze badges
New contributor
asked 8 hours ago
LaTeXNoobLaTeXNoob
61 bronze badge
61 bronze badge
New contributor
New contributor
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
add a comment |
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
add a comment |
3 Answers
3
active
oldest
votes
Here is one way!
documentclass[tikz,border=3mm]standalone
usetikzlibraryshapes.geometric
begindocument
begintikzpicture[thick,>=stealth]
tikzsetbox/.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;
endtikzpicture
enddocument
1
Good answer (+1). Can you align block4 and block3 horizontally?
– ferahfeza
8 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
8 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
8 hours ago
add a comment |
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
usetikzlibraryshapes.geometric
begindocument
beginforest
forked edges,
for tree=l sep=3em,s sep=3em,edge=-stealth,
where n children=2diamondrectangle,inner sep=1ex,draw,
if n=1edge 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;
endforest
enddocument
add a comment |
For fun, a simple pstricks
code:
documentclass[border=6pt]standalone%
usepackage[utf8]inputenc
usepackage[T1]fontenc
usepackagepst-node
newcommandpsstrutrule[-0.55cm]0pt1.25cm
newcommanddiastrutrule[-0.65cm]0pt1.45cm%
begindocument
sffamilyeverymathdisplaystyle%
pssetframesep=1pt, arrows=->, arrowinset=0.1,linejoin=1
beginpsmatrix[rowsep=2.5cm, colsep=2cm, emnode=r]%
%%% Nodes
& dianode[framesep = -2pt]d1diastrut Decision 1\
[name=b1] psframeboxmakebox[2.5cm]psstrut block 1 & & dianode[framesep = -2pt]d2diastrut Decision 2\
& [name=b2] psframeboxmakebox[2.5cm]psstrut block 2 & & [name=b3] psframeboxmakebox[2.5cm]psstrut block 3
%%% Node connections
pssetangleA=-90, angleB=90, armA=0.8cm, armB=0.8cm, labelsep=2pt
ncanglesd1b1nbputyes
ncanglesd1d2naputno
nclineb1d2naputsome condition
ncanglesd2b2nbputyes
ncanglesd2b3naputno
endpsmatrix
enddocument
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Here is one way!
documentclass[tikz,border=3mm]standalone
usetikzlibraryshapes.geometric
begindocument
begintikzpicture[thick,>=stealth]
tikzsetbox/.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;
endtikzpicture
enddocument
1
Good answer (+1). Can you align block4 and block3 horizontally?
– ferahfeza
8 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
8 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
8 hours ago
add a comment |
Here is one way!
documentclass[tikz,border=3mm]standalone
usetikzlibraryshapes.geometric
begindocument
begintikzpicture[thick,>=stealth]
tikzsetbox/.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;
endtikzpicture
enddocument
1
Good answer (+1). Can you align block4 and block3 horizontally?
– ferahfeza
8 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
8 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
8 hours ago
add a comment |
Here is one way!
documentclass[tikz,border=3mm]standalone
usetikzlibraryshapes.geometric
begindocument
begintikzpicture[thick,>=stealth]
tikzsetbox/.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;
endtikzpicture
enddocument
Here is one way!
documentclass[tikz,border=3mm]standalone
usetikzlibraryshapes.geometric
begindocument
begintikzpicture[thick,>=stealth]
tikzsetbox/.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;
endtikzpicture
enddocument
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
8 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
8 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
8 hours ago
add a comment |
1
Good answer (+1). Can you align block4 and block3 horizontally?
– ferahfeza
8 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
8 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
8 hours ago
1
1
Good answer (+1). Can you align block4 and block3 horizontally?
– ferahfeza
8 hours ago
Good answer (+1). Can you align block4 and block3 horizontally?
– ferahfeza
8 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
8 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
8 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
8 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
8 hours ago
add a comment |
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
usetikzlibraryshapes.geometric
begindocument
beginforest
forked edges,
for tree=l sep=3em,s sep=3em,edge=-stealth,
where n children=2diamondrectangle,inner sep=1ex,draw,
if n=1edge 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;
endforest
enddocument
add a comment |
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
usetikzlibraryshapes.geometric
begindocument
beginforest
forked edges,
for tree=l sep=3em,s sep=3em,edge=-stealth,
where n children=2diamondrectangle,inner sep=1ex,draw,
if n=1edge 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;
endforest
enddocument
add a comment |
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
usetikzlibraryshapes.geometric
begindocument
beginforest
forked edges,
for tree=l sep=3em,s sep=3em,edge=-stealth,
where n children=2diamondrectangle,inner sep=1ex,draw,
if n=1edge 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;
endforest
enddocument
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
usetikzlibraryshapes.geometric
begindocument
beginforest
forked edges,
for tree=l sep=3em,s sep=3em,edge=-stealth,
where n children=2diamondrectangle,inner sep=1ex,draw,
if n=1edge 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;
endforest
enddocument
answered 8 hours ago
marmotmarmot
140k6 gold badges184 silver badges338 bronze badges
140k6 gold badges184 silver badges338 bronze badges
add a comment |
add a comment |
For fun, a simple pstricks
code:
documentclass[border=6pt]standalone%
usepackage[utf8]inputenc
usepackage[T1]fontenc
usepackagepst-node
newcommandpsstrutrule[-0.55cm]0pt1.25cm
newcommanddiastrutrule[-0.65cm]0pt1.45cm%
begindocument
sffamilyeverymathdisplaystyle%
pssetframesep=1pt, arrows=->, arrowinset=0.1,linejoin=1
beginpsmatrix[rowsep=2.5cm, colsep=2cm, emnode=r]%
%%% Nodes
& dianode[framesep = -2pt]d1diastrut Decision 1\
[name=b1] psframeboxmakebox[2.5cm]psstrut block 1 & & dianode[framesep = -2pt]d2diastrut Decision 2\
& [name=b2] psframeboxmakebox[2.5cm]psstrut block 2 & & [name=b3] psframeboxmakebox[2.5cm]psstrut block 3
%%% Node connections
pssetangleA=-90, angleB=90, armA=0.8cm, armB=0.8cm, labelsep=2pt
ncanglesd1b1nbputyes
ncanglesd1d2naputno
nclineb1d2naputsome condition
ncanglesd2b2nbputyes
ncanglesd2b3naputno
endpsmatrix
enddocument
add a comment |
For fun, a simple pstricks
code:
documentclass[border=6pt]standalone%
usepackage[utf8]inputenc
usepackage[T1]fontenc
usepackagepst-node
newcommandpsstrutrule[-0.55cm]0pt1.25cm
newcommanddiastrutrule[-0.65cm]0pt1.45cm%
begindocument
sffamilyeverymathdisplaystyle%
pssetframesep=1pt, arrows=->, arrowinset=0.1,linejoin=1
beginpsmatrix[rowsep=2.5cm, colsep=2cm, emnode=r]%
%%% Nodes
& dianode[framesep = -2pt]d1diastrut Decision 1\
[name=b1] psframeboxmakebox[2.5cm]psstrut block 1 & & dianode[framesep = -2pt]d2diastrut Decision 2\
& [name=b2] psframeboxmakebox[2.5cm]psstrut block 2 & & [name=b3] psframeboxmakebox[2.5cm]psstrut block 3
%%% Node connections
pssetangleA=-90, angleB=90, armA=0.8cm, armB=0.8cm, labelsep=2pt
ncanglesd1b1nbputyes
ncanglesd1d2naputno
nclineb1d2naputsome condition
ncanglesd2b2nbputyes
ncanglesd2b3naputno
endpsmatrix
enddocument
add a comment |
For fun, a simple pstricks
code:
documentclass[border=6pt]standalone%
usepackage[utf8]inputenc
usepackage[T1]fontenc
usepackagepst-node
newcommandpsstrutrule[-0.55cm]0pt1.25cm
newcommanddiastrutrule[-0.65cm]0pt1.45cm%
begindocument
sffamilyeverymathdisplaystyle%
pssetframesep=1pt, arrows=->, arrowinset=0.1,linejoin=1
beginpsmatrix[rowsep=2.5cm, colsep=2cm, emnode=r]%
%%% Nodes
& dianode[framesep = -2pt]d1diastrut Decision 1\
[name=b1] psframeboxmakebox[2.5cm]psstrut block 1 & & dianode[framesep = -2pt]d2diastrut Decision 2\
& [name=b2] psframeboxmakebox[2.5cm]psstrut block 2 & & [name=b3] psframeboxmakebox[2.5cm]psstrut block 3
%%% Node connections
pssetangleA=-90, angleB=90, armA=0.8cm, armB=0.8cm, labelsep=2pt
ncanglesd1b1nbputyes
ncanglesd1d2naputno
nclineb1d2naputsome condition
ncanglesd2b2nbputyes
ncanglesd2b3naputno
endpsmatrix
enddocument
For fun, a simple pstricks
code:
documentclass[border=6pt]standalone%
usepackage[utf8]inputenc
usepackage[T1]fontenc
usepackagepst-node
newcommandpsstrutrule[-0.55cm]0pt1.25cm
newcommanddiastrutrule[-0.65cm]0pt1.45cm%
begindocument
sffamilyeverymathdisplaystyle%
pssetframesep=1pt, arrows=->, arrowinset=0.1,linejoin=1
beginpsmatrix[rowsep=2.5cm, colsep=2cm, emnode=r]%
%%% Nodes
& dianode[framesep = -2pt]d1diastrut Decision 1\
[name=b1] psframeboxmakebox[2.5cm]psstrut block 1 & & dianode[framesep = -2pt]d2diastrut Decision 2\
& [name=b2] psframeboxmakebox[2.5cm]psstrut block 2 & & [name=b3] psframeboxmakebox[2.5cm]psstrut block 3
%%% Node connections
pssetangleA=-90, angleB=90, armA=0.8cm, armB=0.8cm, labelsep=2pt
ncanglesd1b1nbputyes
ncanglesd1d2naputno
nclineb1d2naputsome condition
ncanglesd2b2nbputyes
ncanglesd2b3naputno
endpsmatrix
enddocument
answered 7 hours ago
BernardBernard
182k7 gold badges83 silver badges216 bronze badges
182k7 gold badges83 silver badges216 bronze badges
add a comment |
add a comment |
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.
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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