I need help with tikz tree node and label, offsets and inclination












2















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.



enter image description here



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:
enter image description here



Thanks in advance.










share|improve this question









New contributor




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
















  • 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
    6 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
    5 hours ago











  • It's not customary to add “SOLVED” to the title.

    – egreg
    4 hours ago
















2















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.



enter image description here



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:
enter image description here



Thanks in advance.










share|improve this question









New contributor




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
















  • 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
    6 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
    5 hours ago











  • It's not customary to add “SOLVED” to the title.

    – egreg
    4 hours ago














2












2








2








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.



enter image description here



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:
enter image description here



Thanks in advance.










share|improve this question









New contributor




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












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.



enter image description here



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:
enter image description here



Thanks in advance.







tikz-trees






share|improve this question









New contributor




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











share|improve this question









New contributor




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









share|improve this question




share|improve this question








edited 4 hours ago









egreg

725k8819193224




725k8819193224






New contributor




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









asked 6 hours ago









thecharliexthecharliex

235




235




New contributor




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





New contributor





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






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








  • 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
    6 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
    5 hours ago











  • It's not customary to add “SOLVED” to the title.

    – egreg
    4 hours ago














  • 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
    6 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
    5 hours ago











  • It's not customary to add “SOLVED” to the title.

    – egreg
    4 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
6 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
6 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
5 hours ago





You can add above or below or xshift=...mm or yshift=...mm into node definitions for black dots positions.

– ferahfeza
5 hours ago













It's not customary to add “SOLVED” to the title.

– egreg
4 hours ago





It's not customary to add “SOLVED” to the title.

– egreg
4 hours ago










2 Answers
2






active

oldest

votes


















2














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}


enter image description here



On the long run you may benefit from switching to forest.`






share|improve this answer































    1














    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:



    enter image description here



    thanks all @marmot, @ferahfeza






    share|improve this answer








    New contributor




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




















      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.










      draft saved

      draft discarded


















      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









      2














      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}


      enter image description here



      On the long run you may benefit from switching to forest.`






      share|improve this answer




























        2














        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}


        enter image description here



        On the long run you may benefit from switching to forest.`






        share|improve this answer


























          2












          2








          2







          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}


          enter image description here



          On the long run you may benefit from switching to forest.`






          share|improve this answer













          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}


          enter image description here



          On the long run you may benefit from switching to forest.`







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 5 hours ago









          marmotmarmot

          107k5129243




          107k5129243























              1














              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:



              enter image description here



              thanks all @marmot, @ferahfeza






              share|improve this answer








              New contributor




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

























                1














                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:



                enter image description here



                thanks all @marmot, @ferahfeza






                share|improve this answer








                New contributor




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























                  1












                  1








                  1







                  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:



                  enter image description here



                  thanks all @marmot, @ferahfeza






                  share|improve this answer








                  New contributor




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










                  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:



                  enter image description here



                  thanks all @marmot, @ferahfeza







                  share|improve this answer








                  New contributor




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









                  share|improve this answer



                  share|improve this answer






                  New contributor




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









                  answered 4 hours ago









                  thecharliexthecharliex

                  235




                  235




                  New contributor




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





                  New contributor





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






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






















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










                      draft saved

                      draft discarded


















                      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.




                      draft saved


                      draft discarded














                      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





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

                      Mangá

                      Eduardo VII do Reino Unido