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
Why are examinees often not allowed to leave during the start and end of an exam?
Can I take Amul cottage cheese from India to Netherlands?
Perform mirror symmetry transformation of 3D model (in OBJ)
Russian equivalents of 能骗就骗 (if you can cheat, then cheat)
How did they film the Invisible Man being invisible in 1933?
Why was Pan Am Flight 103 flying over Lockerbie?
How can an inexperienced GM keep a game fun for experienced players?
Tricolour nonogram
Can I submit a paper to two or more journals at the same time?
How soon after takeoff can you recline your airplane seat?
Hard for me to understand one tip written in "The as-if rule" of cppreference
Installed software from source, how to say yum not to install it from package?
What overwrites /etc/resolv.conf roughly every hour?
Why isn't UDP with reliability (implemented at Application layer) a substitute of TCP?
Reusable spacecraft: why still have fairings detach, instead of open/close?
How do I keep a running total of data in a column in Excel?
Can dual citizens open crypto exchange accounts where U.S. citizens are prohibited?
What was the point of separating stdout and stderr?
Is this house-rule removing the increased effect of cantrips at higher character levels balanced?
Is it OK to throw pebbles and stones in streams, waterfalls, ponds, etc.?
Why are symbols not written in words?
Does a lens with a bigger max. aperture focus faster than a lens with a smaller max. aperture?
German idiomatic equivalents of 能骗就骗 (if you can cheat, then cheat)
"I am [the / an] owner of a bookstore"?
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
7 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
7 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 7 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
7 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
7 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
7 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
7 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
7 hours ago
@Teepeemm Of course, will post it below as answer.
– LaTeXNoob
7 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
7 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
7 hours ago
add a comment |
4 Answers
4
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
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
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 |
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.
New contributor
2
Welcome to TeX.SX! You shouldn't add this as an answer. You should edit your question and put the code there.
– Phelype Oleinik
7 hours ago
Okay thank you for the info, I will do that next time. Can I delete an answer?
– LaTeXNoob
7 hours ago
1
Yes, there is adelete
button below the answer, in the lower left corner.
– Phelype Oleinik
7 hours ago
Please use the edit link on your question to add additional information. The Post Answer button should be used only for complete answers to the question. - From Review
– siracusa
4 hours ago
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
4 Answers
4
active
oldest
votes
4 Answers
4
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
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
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
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
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 7 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
add a comment |
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
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 7 hours ago
marmotmarmot
140k6 gold badges184 silver badges337 bronze badges
140k6 gold badges184 silver badges337 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 |
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.
New contributor
2
Welcome to TeX.SX! You shouldn't add this as an answer. You should edit your question and put the code there.
– Phelype Oleinik
7 hours ago
Okay thank you for the info, I will do that next time. Can I delete an answer?
– LaTeXNoob
7 hours ago
1
Yes, there is adelete
button below the answer, in the lower left corner.
– Phelype Oleinik
7 hours ago
Please use the edit link on your question to add additional information. The Post Answer button should be used only for complete answers to the question. - From Review
– siracusa
4 hours ago
add a comment |
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.
New contributor
2
Welcome to TeX.SX! You shouldn't add this as an answer. You should edit your question and put the code there.
– Phelype Oleinik
7 hours ago
Okay thank you for the info, I will do that next time. Can I delete an answer?
– LaTeXNoob
7 hours ago
1
Yes, there is adelete
button below the answer, in the lower left corner.
– Phelype Oleinik
7 hours ago
Please use the edit link on your question to add additional information. The Post Answer button should be used only for complete answers to the question. - From Review
– siracusa
4 hours ago
add a comment |
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.
New contributor
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.
New contributor
New contributor
answered 7 hours ago
LaTeXNoobLaTeXNoob
61 bronze badge
61 bronze badge
New contributor
New contributor
2
Welcome to TeX.SX! You shouldn't add this as an answer. You should edit your question and put the code there.
– Phelype Oleinik
7 hours ago
Okay thank you for the info, I will do that next time. Can I delete an answer?
– LaTeXNoob
7 hours ago
1
Yes, there is adelete
button below the answer, in the lower left corner.
– Phelype Oleinik
7 hours ago
Please use the edit link on your question to add additional information. The Post Answer button should be used only for complete answers to the question. - From Review
– siracusa
4 hours ago
add a comment |
2
Welcome to TeX.SX! You shouldn't add this as an answer. You should edit your question and put the code there.
– Phelype Oleinik
7 hours ago
Okay thank you for the info, I will do that next time. Can I delete an answer?
– LaTeXNoob
7 hours ago
1
Yes, there is adelete
button below the answer, in the lower left corner.
– Phelype Oleinik
7 hours ago
Please use the edit link on your question to add additional information. The Post Answer button should be used only for complete answers to the question. - From Review
– siracusa
4 hours ago
2
2
Welcome to TeX.SX! You shouldn't add this as an answer. You should edit your question and put the code there.
– Phelype Oleinik
7 hours ago
Welcome to TeX.SX! You shouldn't add this as an answer. You should edit your question and put the code there.
– Phelype Oleinik
7 hours ago
Okay thank you for the info, I will do that next time. Can I delete an answer?
– LaTeXNoob
7 hours ago
Okay thank you for the info, I will do that next time. Can I delete an answer?
– LaTeXNoob
7 hours ago
1
1
Yes, there is a
delete
button below the answer, in the lower left corner.– Phelype Oleinik
7 hours ago
Yes, there is a
delete
button below the answer, in the lower left corner.– Phelype Oleinik
7 hours ago
Please use the edit link on your question to add additional information. The Post Answer button should be used only for complete answers to the question. - From Review
– siracusa
4 hours ago
Please use the edit link on your question to add additional information. The Post Answer button should be used only for complete answers to the question. - From Review
– siracusa
4 hours ago
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
7 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
7 hours ago