I need help with tikz tree node and label, offsets and inclinationProbability tree using TikZ for Bernoulli...
Having the player face themselves after the mid-game
Does Christianity allow for believing on someone else's behalf?
I can't die. Who am I?
Getting the || sign while using Kurier
PTIJ: Why does only a Shor Tam ask at the Seder, and not a Shor Mu'ad?
What are some noteworthy "mic-drop" moments in math?
I reported the illegal activity of my boss to his boss. My boss found out. Now I am being punished. What should I do?
Finitely many repeated replacements
Professor forcing me to attend a conference, I can't afford even with 50% funding
How do spaceships determine each other's mass in space?
Outlet with 3 sets of wires
Has a sovereign Communist government ever run, and conceded loss, on a fair election?
What will happen if my luggage gets delayed?
MySQL importing CSV files really slow
Is it possible to avoid unpacking when merging Association?
Vocabulary for giving just numbers, not a full answer
Is this Paypal Github SDK reference really a dangerous site?
Why do we say ‘pairwise disjoint’, rather than ‘disjoint’?
Why restrict private health insurance?
From an axiomatic set theoric approach why can we take uncountable unions?
When Schnorr signatures are part of Bitcoin will it be possible validate each block with only one signature validation?
Can one live in the U.S. and not use a credit card?
Is it possible that a question has only two answers?
Is it a Cyclops number? "Nobody" knows!
I need help with tikz tree node and label, offsets and inclination
Probability tree using TikZ for Bernoulli experiments?nodes structure like file systemTikz-Tree: Arrow-style depending on parent nodeHow to draw a tree with fixed node distances?Adjust edge endpoints depending on node labelText alignment and form of connectors (edges) in tikz treeforest: Draw a roof over multiple children in forest?Tikz Tree problem with positionMindmap and trees : length of edges for the 3rd level nodes and the rotation around the Root Nodelinking cousins in a binary tree
I need to draw something like this:
My problem are the black dots position i.e. nodes S and M and the labels position, also the number labels does not look good too.
The X node is beside Coke node not in the edge between Cabonated_Drinks and Coke.
this is what i got:
documentclass{standalone}
usepackage{tikz}
usepackage{amsmath}
tikzset{
solid node/.style={circle,draw,inner sep=1.2,fill=black},
hollow node/.style={circle,draw,inner sep=1.2},
}
begin{document}
begin{tikzpicture}[font=footnotesize]
tikzset{
level 1/.style={level distance=15mm,sibling distance=45mm},
level 2/.style={level distance=15mm,sibling distance=30mm},
level 3/.style={level distance=15mm,sibling distance=15mm},
level 4/.style={level distance=15mm,sibling distance=10mm},
}
node(A)[hollow node,label=above:{ALL}]{}
child {
%node(B)[hollow node,label=left:{Carbonated Drinks}]{}
node(B)[hollow node,label={[align=left]left:Carbonated\Drinks}]{}
child {node(D)[hollow node, label=below:{Coke}]{}
edge from parent{
node[solid node, left, label=left:{X}, at end]{}
node[right]{1}
}
}
child {node(E)[hollow node, label=below:{Pepsi}]{}
edge from parent{
node[left]{1}
node[solid node, right, near start, label=right:{T}]{}
}
}
edge from parent{
node[solid node, left, near start, label=left:{S}]{}
node[solid node, right, near start, label=right:{M}]{}
}
edge from parent{
node[right]{1}
}
}
child {
node(C)[hollow node,label=right:{Coffee}]{}
child {
node(F)[hollow node, label=below:{Mocca}]{}
edge from parent{
node[right]{1}
}
}
child {
node(G)[hollow node, label=below:{Nescaffe}]{}
edge from parent{
node[left]{1}
}
}
edge from parent{
node[left]{1}
}
};
end{tikzpicture}
end{document}
What gives me an image like this:
Thanks in advance.
tikz-trees
New contributor
add a comment |
I need to draw something like this:
My problem are the black dots position i.e. nodes S and M and the labels position, also the number labels does not look good too.
The X node is beside Coke node not in the edge between Cabonated_Drinks and Coke.
this is what i got:
documentclass{standalone}
usepackage{tikz}
usepackage{amsmath}
tikzset{
solid node/.style={circle,draw,inner sep=1.2,fill=black},
hollow node/.style={circle,draw,inner sep=1.2},
}
begin{document}
begin{tikzpicture}[font=footnotesize]
tikzset{
level 1/.style={level distance=15mm,sibling distance=45mm},
level 2/.style={level distance=15mm,sibling distance=30mm},
level 3/.style={level distance=15mm,sibling distance=15mm},
level 4/.style={level distance=15mm,sibling distance=10mm},
}
node(A)[hollow node,label=above:{ALL}]{}
child {
%node(B)[hollow node,label=left:{Carbonated Drinks}]{}
node(B)[hollow node,label={[align=left]left:Carbonated\Drinks}]{}
child {node(D)[hollow node, label=below:{Coke}]{}
edge from parent{
node[solid node, left, label=left:{X}, at end]{}
node[right]{1}
}
}
child {node(E)[hollow node, label=below:{Pepsi}]{}
edge from parent{
node[left]{1}
node[solid node, right, near start, label=right:{T}]{}
}
}
edge from parent{
node[solid node, left, near start, label=left:{S}]{}
node[solid node, right, near start, label=right:{M}]{}
}
edge from parent{
node[right]{1}
}
}
child {
node(C)[hollow node,label=right:{Coffee}]{}
child {
node(F)[hollow node, label=below:{Mocca}]{}
edge from parent{
node[right]{1}
}
}
child {
node(G)[hollow node, label=below:{Nescaffe}]{}
edge from parent{
node[left]{1}
}
}
edge from parent{
node[left]{1}
}
};
end{tikzpicture}
end{document}
What gives me an image like this:
Thanks in advance.
tikz-trees
New contributor
2
Welcome to TeX.SE! And the proble you have are the positions of the black points? Please do not only show a image and some code, explain your problem in words too!
– Kurt
5 hours ago
[edited] My problem are the black dots position and the labels position, also the number labels does not look good too.
– thecharliex
5 hours ago
You can addabove
orbelow
orxshift=...mm
oryshift=...mm
into node definitions for black dots positions.
– ferahfeza
4 hours ago
It's not customary to add “SOLVED” to the title.
– egreg
3 hours ago
add a comment |
I need to draw something like this:
My problem are the black dots position i.e. nodes S and M and the labels position, also the number labels does not look good too.
The X node is beside Coke node not in the edge between Cabonated_Drinks and Coke.
this is what i got:
documentclass{standalone}
usepackage{tikz}
usepackage{amsmath}
tikzset{
solid node/.style={circle,draw,inner sep=1.2,fill=black},
hollow node/.style={circle,draw,inner sep=1.2},
}
begin{document}
begin{tikzpicture}[font=footnotesize]
tikzset{
level 1/.style={level distance=15mm,sibling distance=45mm},
level 2/.style={level distance=15mm,sibling distance=30mm},
level 3/.style={level distance=15mm,sibling distance=15mm},
level 4/.style={level distance=15mm,sibling distance=10mm},
}
node(A)[hollow node,label=above:{ALL}]{}
child {
%node(B)[hollow node,label=left:{Carbonated Drinks}]{}
node(B)[hollow node,label={[align=left]left:Carbonated\Drinks}]{}
child {node(D)[hollow node, label=below:{Coke}]{}
edge from parent{
node[solid node, left, label=left:{X}, at end]{}
node[right]{1}
}
}
child {node(E)[hollow node, label=below:{Pepsi}]{}
edge from parent{
node[left]{1}
node[solid node, right, near start, label=right:{T}]{}
}
}
edge from parent{
node[solid node, left, near start, label=left:{S}]{}
node[solid node, right, near start, label=right:{M}]{}
}
edge from parent{
node[right]{1}
}
}
child {
node(C)[hollow node,label=right:{Coffee}]{}
child {
node(F)[hollow node, label=below:{Mocca}]{}
edge from parent{
node[right]{1}
}
}
child {
node(G)[hollow node, label=below:{Nescaffe}]{}
edge from parent{
node[left]{1}
}
}
edge from parent{
node[left]{1}
}
};
end{tikzpicture}
end{document}
What gives me an image like this:
Thanks in advance.
tikz-trees
New contributor
I need to draw something like this:
My problem are the black dots position i.e. nodes S and M and the labels position, also the number labels does not look good too.
The X node is beside Coke node not in the edge between Cabonated_Drinks and Coke.
this is what i got:
documentclass{standalone}
usepackage{tikz}
usepackage{amsmath}
tikzset{
solid node/.style={circle,draw,inner sep=1.2,fill=black},
hollow node/.style={circle,draw,inner sep=1.2},
}
begin{document}
begin{tikzpicture}[font=footnotesize]
tikzset{
level 1/.style={level distance=15mm,sibling distance=45mm},
level 2/.style={level distance=15mm,sibling distance=30mm},
level 3/.style={level distance=15mm,sibling distance=15mm},
level 4/.style={level distance=15mm,sibling distance=10mm},
}
node(A)[hollow node,label=above:{ALL}]{}
child {
%node(B)[hollow node,label=left:{Carbonated Drinks}]{}
node(B)[hollow node,label={[align=left]left:Carbonated\Drinks}]{}
child {node(D)[hollow node, label=below:{Coke}]{}
edge from parent{
node[solid node, left, label=left:{X}, at end]{}
node[right]{1}
}
}
child {node(E)[hollow node, label=below:{Pepsi}]{}
edge from parent{
node[left]{1}
node[solid node, right, near start, label=right:{T}]{}
}
}
edge from parent{
node[solid node, left, near start, label=left:{S}]{}
node[solid node, right, near start, label=right:{M}]{}
}
edge from parent{
node[right]{1}
}
}
child {
node(C)[hollow node,label=right:{Coffee}]{}
child {
node(F)[hollow node, label=below:{Mocca}]{}
edge from parent{
node[right]{1}
}
}
child {
node(G)[hollow node, label=below:{Nescaffe}]{}
edge from parent{
node[left]{1}
}
}
edge from parent{
node[left]{1}
}
};
end{tikzpicture}
end{document}
What gives me an image like this:
Thanks in advance.
tikz-trees
tikz-trees
New contributor
New contributor
edited 3 hours ago
egreg
725k8819193224
725k8819193224
New contributor
asked 5 hours ago
thecharliexthecharliex
235
235
New contributor
New contributor
2
Welcome to TeX.SE! And the proble you have are the positions of the black points? Please do not only show a image and some code, explain your problem in words too!
– Kurt
5 hours ago
[edited] My problem are the black dots position and the labels position, also the number labels does not look good too.
– thecharliex
5 hours ago
You can addabove
orbelow
orxshift=...mm
oryshift=...mm
into node definitions for black dots positions.
– ferahfeza
4 hours ago
It's not customary to add “SOLVED” to the title.
– egreg
3 hours ago
add a comment |
2
Welcome to TeX.SE! And the proble you have are the positions of the black points? Please do not only show a image and some code, explain your problem in words too!
– Kurt
5 hours ago
[edited] My problem are the black dots position and the labels position, also the number labels does not look good too.
– thecharliex
5 hours ago
You can addabove
orbelow
orxshift=...mm
oryshift=...mm
into node definitions for black dots positions.
– ferahfeza
4 hours ago
It's not customary to add “SOLVED” to the title.
– egreg
3 hours ago
2
2
Welcome to TeX.SE! And the proble you have are the positions of the black points? Please do not only show a image and some code, explain your problem in words too!
– Kurt
5 hours ago
Welcome to TeX.SE! And the proble you have are the positions of the black points? Please do not only show a image and some code, explain your problem in words too!
– Kurt
5 hours ago
[edited] My problem are the black dots position and the labels position, also the number labels does not look good too.
– thecharliex
5 hours ago
[edited] My problem are the black dots position and the labels position, also the number labels does not look good too.
– thecharliex
5 hours ago
You can add
above
or below
or xshift=...mm
or yshift=...mm
into node definitions for black dots positions.– ferahfeza
4 hours ago
You can add
above
or below
or xshift=...mm
or yshift=...mm
into node definitions for black dots positions.– ferahfeza
4 hours ago
It's not customary to add “SOLVED” to the title.
– egreg
3 hours ago
It's not customary to add “SOLVED” to the title.
– egreg
3 hours ago
add a comment |
2 Answers
2
active
oldest
votes
There are two keys which might be useful here: pos
and shift
. Using these, I got
documentclass[tikz,border=3.14mm]{standalone}
usepackage{amsmath}
tikzset{
solid node/.style={circle,draw,inner sep=1.2,fill=black},
hollow node/.style={circle,draw,inner sep=1.2},
}
begin{document}
begin{tikzpicture}[font=footnotesize]
tikzset{
level 1/.style={level distance=15mm,sibling distance=45mm},
level 2/.style={level distance=15mm,sibling distance=30mm},
level 3/.style={level distance=15mm,sibling distance=15mm},
level 4/.style={level distance=15mm,sibling distance=10mm},
}
node(A)[hollow node,label=above:{ALL}]{}
child {
%node(B)[hollow node,label=left:{Carbonated Drinks}]{}
node(B)[hollow node,label={[align=left,xshift=1.5em]135:Carbonated\Drinks}]{}
child {node(D)[hollow node, label=below:{Coke}]{}
edge from parent{
node[solid node,pos=0.95,xshift=-0.5em,left, label=left:{X}]{}
node[pos=0.6,above left]{1}
}
}
child {node(E)[hollow node, label=below:{Pepsi}]{}
edge from parent{
node[pos=0.6,below left]{1}
node[solid node, right, pos=0.4, label=right:{T}]{}
}
}
edge from parent{
node[solid node, left, pos=0.35,shift={(120:2pt)}, label=120:{S}]{}
node[solid node, right, pos=0.35,shift={(-60:2pt)}, label=-60:{M}]{}
node[pos=0.6,above left]{1}
}
}
child {
node(C)[hollow node,label=right:{Coffee}]{}
child {
node(F)[hollow node, label=below:{Mocca}]{}
edge from parent{
node[pos=0.6,above left]{1}
}
}
child {
node(G)[hollow node, label=below:{Nescaffe}]{}
edge from parent{
node[pos=0.6,above right]{1}
}
}
edge from parent{
node[pos=0.6,above right]{1}
}
};
end{tikzpicture}
end{document}
On the long run you may benefit from switching to forest.`
add a comment |
SOLVED
using properly xshift and yshift with labels and nodes as @marmot says...
Here is the improved code:
documentclass{standalone}
usepackage{tikz}
usepackage{amsmath}
tikzset{
solid node/.style={circle, draw, inner sep=2, fill=black, line width=1pt},
hollow node/.style={circle, draw, inner sep=2, line width=1pt },
}
%child{node(l1)[hollow node, label=below:{D}]{}
begin{document}
begin{tikzpicture}[font=footnotesize]
tikzset{
level 1/.style={level distance=15mm,sibling distance=45mm, line width=1pt},
level 2/.style={level distance=15mm,sibling distance=30mm},
level 3/.style={level distance=15mm,sibling distance=15mm},
level 4/.style={level distance=15mm,sibling distance=10mm},
}
node(A)[hollow node,label=above:{ALL}]{}
child {
%node(B)[hollow node,label=left:{Carbonated Drinks}]{}
node(B)[hollow node,label={[align=left]left:Carbonated\Drinks}]{}
child {node(D)[hollow node, label=below:{Coke}]{}
edge from parent{
node[solid node, xshift=-1pt, yshift=+3pt, left, label=left:{X}, at end]{}
node[right]{1}
}
}
child {node(E)[hollow node, label=below:{Pepsi}]{}
edge from parent{
node[left]{1}
node[solid node, rotate=+45pt, right, near start, label={[xshift=-1.0pt, yshift=-9.0pt]right:T}]{}
}
}
edge from parent{
node[solid node, rotate=-45, left, near start,label={[xshift=2.0pt, yshift=-7.0pt]left:S}]{}
node[solid node, rotate=-45, right, near start, label={[xshift=-2.0pt, yshift=7.0pt]right:M}]{}
}
edge from parent{
node[right]{1}
}
}
child {
node(C)[hollow node,label=right:{Coffee}]{}
child {
node(F)[hollow node, label=below:{Mocca}]{}
edge from parent{
node[right]{1}
}
}
child {
node(G)[hollow node, label=below:{Nescaffe}]{}
edge from parent{
node[left]{1}
}
}
edge from parent{
node[left]{1}
}
};
end{tikzpicture}
end{document}
I got:
thanks all @marmot, @ferahfeza
New contributor
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
});
}
});
thecharliex 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%2f478785%2fi-need-help-with-tikz-tree-node-and-label-offsets-and-inclination%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
There are two keys which might be useful here: pos
and shift
. Using these, I got
documentclass[tikz,border=3.14mm]{standalone}
usepackage{amsmath}
tikzset{
solid node/.style={circle,draw,inner sep=1.2,fill=black},
hollow node/.style={circle,draw,inner sep=1.2},
}
begin{document}
begin{tikzpicture}[font=footnotesize]
tikzset{
level 1/.style={level distance=15mm,sibling distance=45mm},
level 2/.style={level distance=15mm,sibling distance=30mm},
level 3/.style={level distance=15mm,sibling distance=15mm},
level 4/.style={level distance=15mm,sibling distance=10mm},
}
node(A)[hollow node,label=above:{ALL}]{}
child {
%node(B)[hollow node,label=left:{Carbonated Drinks}]{}
node(B)[hollow node,label={[align=left,xshift=1.5em]135:Carbonated\Drinks}]{}
child {node(D)[hollow node, label=below:{Coke}]{}
edge from parent{
node[solid node,pos=0.95,xshift=-0.5em,left, label=left:{X}]{}
node[pos=0.6,above left]{1}
}
}
child {node(E)[hollow node, label=below:{Pepsi}]{}
edge from parent{
node[pos=0.6,below left]{1}
node[solid node, right, pos=0.4, label=right:{T}]{}
}
}
edge from parent{
node[solid node, left, pos=0.35,shift={(120:2pt)}, label=120:{S}]{}
node[solid node, right, pos=0.35,shift={(-60:2pt)}, label=-60:{M}]{}
node[pos=0.6,above left]{1}
}
}
child {
node(C)[hollow node,label=right:{Coffee}]{}
child {
node(F)[hollow node, label=below:{Mocca}]{}
edge from parent{
node[pos=0.6,above left]{1}
}
}
child {
node(G)[hollow node, label=below:{Nescaffe}]{}
edge from parent{
node[pos=0.6,above right]{1}
}
}
edge from parent{
node[pos=0.6,above right]{1}
}
};
end{tikzpicture}
end{document}
On the long run you may benefit from switching to forest.`
add a comment |
There are two keys which might be useful here: pos
and shift
. Using these, I got
documentclass[tikz,border=3.14mm]{standalone}
usepackage{amsmath}
tikzset{
solid node/.style={circle,draw,inner sep=1.2,fill=black},
hollow node/.style={circle,draw,inner sep=1.2},
}
begin{document}
begin{tikzpicture}[font=footnotesize]
tikzset{
level 1/.style={level distance=15mm,sibling distance=45mm},
level 2/.style={level distance=15mm,sibling distance=30mm},
level 3/.style={level distance=15mm,sibling distance=15mm},
level 4/.style={level distance=15mm,sibling distance=10mm},
}
node(A)[hollow node,label=above:{ALL}]{}
child {
%node(B)[hollow node,label=left:{Carbonated Drinks}]{}
node(B)[hollow node,label={[align=left,xshift=1.5em]135:Carbonated\Drinks}]{}
child {node(D)[hollow node, label=below:{Coke}]{}
edge from parent{
node[solid node,pos=0.95,xshift=-0.5em,left, label=left:{X}]{}
node[pos=0.6,above left]{1}
}
}
child {node(E)[hollow node, label=below:{Pepsi}]{}
edge from parent{
node[pos=0.6,below left]{1}
node[solid node, right, pos=0.4, label=right:{T}]{}
}
}
edge from parent{
node[solid node, left, pos=0.35,shift={(120:2pt)}, label=120:{S}]{}
node[solid node, right, pos=0.35,shift={(-60:2pt)}, label=-60:{M}]{}
node[pos=0.6,above left]{1}
}
}
child {
node(C)[hollow node,label=right:{Coffee}]{}
child {
node(F)[hollow node, label=below:{Mocca}]{}
edge from parent{
node[pos=0.6,above left]{1}
}
}
child {
node(G)[hollow node, label=below:{Nescaffe}]{}
edge from parent{
node[pos=0.6,above right]{1}
}
}
edge from parent{
node[pos=0.6,above right]{1}
}
};
end{tikzpicture}
end{document}
On the long run you may benefit from switching to forest.`
add a comment |
There are two keys which might be useful here: pos
and shift
. Using these, I got
documentclass[tikz,border=3.14mm]{standalone}
usepackage{amsmath}
tikzset{
solid node/.style={circle,draw,inner sep=1.2,fill=black},
hollow node/.style={circle,draw,inner sep=1.2},
}
begin{document}
begin{tikzpicture}[font=footnotesize]
tikzset{
level 1/.style={level distance=15mm,sibling distance=45mm},
level 2/.style={level distance=15mm,sibling distance=30mm},
level 3/.style={level distance=15mm,sibling distance=15mm},
level 4/.style={level distance=15mm,sibling distance=10mm},
}
node(A)[hollow node,label=above:{ALL}]{}
child {
%node(B)[hollow node,label=left:{Carbonated Drinks}]{}
node(B)[hollow node,label={[align=left,xshift=1.5em]135:Carbonated\Drinks}]{}
child {node(D)[hollow node, label=below:{Coke}]{}
edge from parent{
node[solid node,pos=0.95,xshift=-0.5em,left, label=left:{X}]{}
node[pos=0.6,above left]{1}
}
}
child {node(E)[hollow node, label=below:{Pepsi}]{}
edge from parent{
node[pos=0.6,below left]{1}
node[solid node, right, pos=0.4, label=right:{T}]{}
}
}
edge from parent{
node[solid node, left, pos=0.35,shift={(120:2pt)}, label=120:{S}]{}
node[solid node, right, pos=0.35,shift={(-60:2pt)}, label=-60:{M}]{}
node[pos=0.6,above left]{1}
}
}
child {
node(C)[hollow node,label=right:{Coffee}]{}
child {
node(F)[hollow node, label=below:{Mocca}]{}
edge from parent{
node[pos=0.6,above left]{1}
}
}
child {
node(G)[hollow node, label=below:{Nescaffe}]{}
edge from parent{
node[pos=0.6,above right]{1}
}
}
edge from parent{
node[pos=0.6,above right]{1}
}
};
end{tikzpicture}
end{document}
On the long run you may benefit from switching to forest.`
There are two keys which might be useful here: pos
and shift
. Using these, I got
documentclass[tikz,border=3.14mm]{standalone}
usepackage{amsmath}
tikzset{
solid node/.style={circle,draw,inner sep=1.2,fill=black},
hollow node/.style={circle,draw,inner sep=1.2},
}
begin{document}
begin{tikzpicture}[font=footnotesize]
tikzset{
level 1/.style={level distance=15mm,sibling distance=45mm},
level 2/.style={level distance=15mm,sibling distance=30mm},
level 3/.style={level distance=15mm,sibling distance=15mm},
level 4/.style={level distance=15mm,sibling distance=10mm},
}
node(A)[hollow node,label=above:{ALL}]{}
child {
%node(B)[hollow node,label=left:{Carbonated Drinks}]{}
node(B)[hollow node,label={[align=left,xshift=1.5em]135:Carbonated\Drinks}]{}
child {node(D)[hollow node, label=below:{Coke}]{}
edge from parent{
node[solid node,pos=0.95,xshift=-0.5em,left, label=left:{X}]{}
node[pos=0.6,above left]{1}
}
}
child {node(E)[hollow node, label=below:{Pepsi}]{}
edge from parent{
node[pos=0.6,below left]{1}
node[solid node, right, pos=0.4, label=right:{T}]{}
}
}
edge from parent{
node[solid node, left, pos=0.35,shift={(120:2pt)}, label=120:{S}]{}
node[solid node, right, pos=0.35,shift={(-60:2pt)}, label=-60:{M}]{}
node[pos=0.6,above left]{1}
}
}
child {
node(C)[hollow node,label=right:{Coffee}]{}
child {
node(F)[hollow node, label=below:{Mocca}]{}
edge from parent{
node[pos=0.6,above left]{1}
}
}
child {
node(G)[hollow node, label=below:{Nescaffe}]{}
edge from parent{
node[pos=0.6,above right]{1}
}
}
edge from parent{
node[pos=0.6,above right]{1}
}
};
end{tikzpicture}
end{document}
On the long run you may benefit from switching to forest.`
answered 4 hours ago
marmotmarmot
107k5129243
107k5129243
add a comment |
add a comment |
SOLVED
using properly xshift and yshift with labels and nodes as @marmot says...
Here is the improved code:
documentclass{standalone}
usepackage{tikz}
usepackage{amsmath}
tikzset{
solid node/.style={circle, draw, inner sep=2, fill=black, line width=1pt},
hollow node/.style={circle, draw, inner sep=2, line width=1pt },
}
%child{node(l1)[hollow node, label=below:{D}]{}
begin{document}
begin{tikzpicture}[font=footnotesize]
tikzset{
level 1/.style={level distance=15mm,sibling distance=45mm, line width=1pt},
level 2/.style={level distance=15mm,sibling distance=30mm},
level 3/.style={level distance=15mm,sibling distance=15mm},
level 4/.style={level distance=15mm,sibling distance=10mm},
}
node(A)[hollow node,label=above:{ALL}]{}
child {
%node(B)[hollow node,label=left:{Carbonated Drinks}]{}
node(B)[hollow node,label={[align=left]left:Carbonated\Drinks}]{}
child {node(D)[hollow node, label=below:{Coke}]{}
edge from parent{
node[solid node, xshift=-1pt, yshift=+3pt, left, label=left:{X}, at end]{}
node[right]{1}
}
}
child {node(E)[hollow node, label=below:{Pepsi}]{}
edge from parent{
node[left]{1}
node[solid node, rotate=+45pt, right, near start, label={[xshift=-1.0pt, yshift=-9.0pt]right:T}]{}
}
}
edge from parent{
node[solid node, rotate=-45, left, near start,label={[xshift=2.0pt, yshift=-7.0pt]left:S}]{}
node[solid node, rotate=-45, right, near start, label={[xshift=-2.0pt, yshift=7.0pt]right:M}]{}
}
edge from parent{
node[right]{1}
}
}
child {
node(C)[hollow node,label=right:{Coffee}]{}
child {
node(F)[hollow node, label=below:{Mocca}]{}
edge from parent{
node[right]{1}
}
}
child {
node(G)[hollow node, label=below:{Nescaffe}]{}
edge from parent{
node[left]{1}
}
}
edge from parent{
node[left]{1}
}
};
end{tikzpicture}
end{document}
I got:
thanks all @marmot, @ferahfeza
New contributor
add a comment |
SOLVED
using properly xshift and yshift with labels and nodes as @marmot says...
Here is the improved code:
documentclass{standalone}
usepackage{tikz}
usepackage{amsmath}
tikzset{
solid node/.style={circle, draw, inner sep=2, fill=black, line width=1pt},
hollow node/.style={circle, draw, inner sep=2, line width=1pt },
}
%child{node(l1)[hollow node, label=below:{D}]{}
begin{document}
begin{tikzpicture}[font=footnotesize]
tikzset{
level 1/.style={level distance=15mm,sibling distance=45mm, line width=1pt},
level 2/.style={level distance=15mm,sibling distance=30mm},
level 3/.style={level distance=15mm,sibling distance=15mm},
level 4/.style={level distance=15mm,sibling distance=10mm},
}
node(A)[hollow node,label=above:{ALL}]{}
child {
%node(B)[hollow node,label=left:{Carbonated Drinks}]{}
node(B)[hollow node,label={[align=left]left:Carbonated\Drinks}]{}
child {node(D)[hollow node, label=below:{Coke}]{}
edge from parent{
node[solid node, xshift=-1pt, yshift=+3pt, left, label=left:{X}, at end]{}
node[right]{1}
}
}
child {node(E)[hollow node, label=below:{Pepsi}]{}
edge from parent{
node[left]{1}
node[solid node, rotate=+45pt, right, near start, label={[xshift=-1.0pt, yshift=-9.0pt]right:T}]{}
}
}
edge from parent{
node[solid node, rotate=-45, left, near start,label={[xshift=2.0pt, yshift=-7.0pt]left:S}]{}
node[solid node, rotate=-45, right, near start, label={[xshift=-2.0pt, yshift=7.0pt]right:M}]{}
}
edge from parent{
node[right]{1}
}
}
child {
node(C)[hollow node,label=right:{Coffee}]{}
child {
node(F)[hollow node, label=below:{Mocca}]{}
edge from parent{
node[right]{1}
}
}
child {
node(G)[hollow node, label=below:{Nescaffe}]{}
edge from parent{
node[left]{1}
}
}
edge from parent{
node[left]{1}
}
};
end{tikzpicture}
end{document}
I got:
thanks all @marmot, @ferahfeza
New contributor
add a comment |
SOLVED
using properly xshift and yshift with labels and nodes as @marmot says...
Here is the improved code:
documentclass{standalone}
usepackage{tikz}
usepackage{amsmath}
tikzset{
solid node/.style={circle, draw, inner sep=2, fill=black, line width=1pt},
hollow node/.style={circle, draw, inner sep=2, line width=1pt },
}
%child{node(l1)[hollow node, label=below:{D}]{}
begin{document}
begin{tikzpicture}[font=footnotesize]
tikzset{
level 1/.style={level distance=15mm,sibling distance=45mm, line width=1pt},
level 2/.style={level distance=15mm,sibling distance=30mm},
level 3/.style={level distance=15mm,sibling distance=15mm},
level 4/.style={level distance=15mm,sibling distance=10mm},
}
node(A)[hollow node,label=above:{ALL}]{}
child {
%node(B)[hollow node,label=left:{Carbonated Drinks}]{}
node(B)[hollow node,label={[align=left]left:Carbonated\Drinks}]{}
child {node(D)[hollow node, label=below:{Coke}]{}
edge from parent{
node[solid node, xshift=-1pt, yshift=+3pt, left, label=left:{X}, at end]{}
node[right]{1}
}
}
child {node(E)[hollow node, label=below:{Pepsi}]{}
edge from parent{
node[left]{1}
node[solid node, rotate=+45pt, right, near start, label={[xshift=-1.0pt, yshift=-9.0pt]right:T}]{}
}
}
edge from parent{
node[solid node, rotate=-45, left, near start,label={[xshift=2.0pt, yshift=-7.0pt]left:S}]{}
node[solid node, rotate=-45, right, near start, label={[xshift=-2.0pt, yshift=7.0pt]right:M}]{}
}
edge from parent{
node[right]{1}
}
}
child {
node(C)[hollow node,label=right:{Coffee}]{}
child {
node(F)[hollow node, label=below:{Mocca}]{}
edge from parent{
node[right]{1}
}
}
child {
node(G)[hollow node, label=below:{Nescaffe}]{}
edge from parent{
node[left]{1}
}
}
edge from parent{
node[left]{1}
}
};
end{tikzpicture}
end{document}
I got:
thanks all @marmot, @ferahfeza
New contributor
SOLVED
using properly xshift and yshift with labels and nodes as @marmot says...
Here is the improved code:
documentclass{standalone}
usepackage{tikz}
usepackage{amsmath}
tikzset{
solid node/.style={circle, draw, inner sep=2, fill=black, line width=1pt},
hollow node/.style={circle, draw, inner sep=2, line width=1pt },
}
%child{node(l1)[hollow node, label=below:{D}]{}
begin{document}
begin{tikzpicture}[font=footnotesize]
tikzset{
level 1/.style={level distance=15mm,sibling distance=45mm, line width=1pt},
level 2/.style={level distance=15mm,sibling distance=30mm},
level 3/.style={level distance=15mm,sibling distance=15mm},
level 4/.style={level distance=15mm,sibling distance=10mm},
}
node(A)[hollow node,label=above:{ALL}]{}
child {
%node(B)[hollow node,label=left:{Carbonated Drinks}]{}
node(B)[hollow node,label={[align=left]left:Carbonated\Drinks}]{}
child {node(D)[hollow node, label=below:{Coke}]{}
edge from parent{
node[solid node, xshift=-1pt, yshift=+3pt, left, label=left:{X}, at end]{}
node[right]{1}
}
}
child {node(E)[hollow node, label=below:{Pepsi}]{}
edge from parent{
node[left]{1}
node[solid node, rotate=+45pt, right, near start, label={[xshift=-1.0pt, yshift=-9.0pt]right:T}]{}
}
}
edge from parent{
node[solid node, rotate=-45, left, near start,label={[xshift=2.0pt, yshift=-7.0pt]left:S}]{}
node[solid node, rotate=-45, right, near start, label={[xshift=-2.0pt, yshift=7.0pt]right:M}]{}
}
edge from parent{
node[right]{1}
}
}
child {
node(C)[hollow node,label=right:{Coffee}]{}
child {
node(F)[hollow node, label=below:{Mocca}]{}
edge from parent{
node[right]{1}
}
}
child {
node(G)[hollow node, label=below:{Nescaffe}]{}
edge from parent{
node[left]{1}
}
}
edge from parent{
node[left]{1}
}
};
end{tikzpicture}
end{document}
I got:
thanks all @marmot, @ferahfeza
New contributor
New contributor
answered 3 hours ago
thecharliexthecharliex
235
235
New contributor
New contributor
add a comment |
add a comment |
thecharliex is a new contributor. Be nice, and check out our Code of Conduct.
thecharliex is a new contributor. Be nice, and check out our Code of Conduct.
thecharliex is a new contributor. Be nice, and check out our Code of Conduct.
thecharliex 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%2f478785%2fi-need-help-with-tikz-tree-node-and-label-offsets-and-inclination%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
2
Welcome to TeX.SE! And the proble you have are the positions of the black points? Please do not only show a image and some code, explain your problem in words too!
– Kurt
5 hours ago
[edited] My problem are the black dots position and the labels position, also the number labels does not look good too.
– thecharliex
5 hours ago
You can add
above
orbelow
orxshift=...mm
oryshift=...mm
into node definitions for black dots positions.– ferahfeza
4 hours ago
It's not customary to add “SOLVED” to the title.
– egreg
3 hours ago