Customized node of graph in tikz











up vote
4
down vote

favorite












I found the following picture of snowflakes:



begin{tikzpicture}[decoration=Koch snowflake]
draw decorate{decorate{decorate{decorate{(0,0) -- (3,0)}}}};
draw decorate{decorate{decorate{decorate{(3,0) -- (1.5,-3)}}}};
draw decorate{decorate{decorate{decorate{(1.5,-3) -- (0,0)}}}};
end{tikzpicture}


Can I use it to replace circles (nodes) of a graph drawn in tikz? This is my graph:



begin{tikzpicture}
[scale=.6,auto=right,every node/.style={circle,fill=yellow!70}]
node (n6) at (31,20) {6};
node (n4) at (34,18) {4};
node (n5) at (38,19) {5};
node (n1) at (41,18) {1};
node (n2) at (39,16) {2};
node (n3) at (35,15) {3};

foreach from/to in {n6/n4,n4/n5,n5/n1,n1/n2,n2/n5,n2/n3,n3/n4}
draw (from) -- (to);

end{tikzpicture}









share|improve this question


























    up vote
    4
    down vote

    favorite












    I found the following picture of snowflakes:



    begin{tikzpicture}[decoration=Koch snowflake]
    draw decorate{decorate{decorate{decorate{(0,0) -- (3,0)}}}};
    draw decorate{decorate{decorate{decorate{(3,0) -- (1.5,-3)}}}};
    draw decorate{decorate{decorate{decorate{(1.5,-3) -- (0,0)}}}};
    end{tikzpicture}


    Can I use it to replace circles (nodes) of a graph drawn in tikz? This is my graph:



    begin{tikzpicture}
    [scale=.6,auto=right,every node/.style={circle,fill=yellow!70}]
    node (n6) at (31,20) {6};
    node (n4) at (34,18) {4};
    node (n5) at (38,19) {5};
    node (n1) at (41,18) {1};
    node (n2) at (39,16) {2};
    node (n3) at (35,15) {3};

    foreach from/to in {n6/n4,n4/n5,n5/n1,n1/n2,n2/n5,n2/n3,n3/n4}
    draw (from) -- (to);

    end{tikzpicture}









    share|improve this question
























      up vote
      4
      down vote

      favorite









      up vote
      4
      down vote

      favorite











      I found the following picture of snowflakes:



      begin{tikzpicture}[decoration=Koch snowflake]
      draw decorate{decorate{decorate{decorate{(0,0) -- (3,0)}}}};
      draw decorate{decorate{decorate{decorate{(3,0) -- (1.5,-3)}}}};
      draw decorate{decorate{decorate{decorate{(1.5,-3) -- (0,0)}}}};
      end{tikzpicture}


      Can I use it to replace circles (nodes) of a graph drawn in tikz? This is my graph:



      begin{tikzpicture}
      [scale=.6,auto=right,every node/.style={circle,fill=yellow!70}]
      node (n6) at (31,20) {6};
      node (n4) at (34,18) {4};
      node (n5) at (38,19) {5};
      node (n1) at (41,18) {1};
      node (n2) at (39,16) {2};
      node (n3) at (35,15) {3};

      foreach from/to in {n6/n4,n4/n5,n5/n1,n1/n2,n2/n5,n2/n3,n3/n4}
      draw (from) -- (to);

      end{tikzpicture}









      share|improve this question













      I found the following picture of snowflakes:



      begin{tikzpicture}[decoration=Koch snowflake]
      draw decorate{decorate{decorate{decorate{(0,0) -- (3,0)}}}};
      draw decorate{decorate{decorate{decorate{(3,0) -- (1.5,-3)}}}};
      draw decorate{decorate{decorate{decorate{(1.5,-3) -- (0,0)}}}};
      end{tikzpicture}


      Can I use it to replace circles (nodes) of a graph drawn in tikz? This is my graph:



      begin{tikzpicture}
      [scale=.6,auto=right,every node/.style={circle,fill=yellow!70}]
      node (n6) at (31,20) {6};
      node (n4) at (34,18) {4};
      node (n5) at (38,19) {5};
      node (n1) at (41,18) {1};
      node (n2) at (39,16) {2};
      node (n3) at (35,15) {3};

      foreach from/to in {n6/n4,n4/n5,n5/n1,n1/n2,n2/n5,n2/n3,n3/n4}
      draw (from) -- (to);

      end{tikzpicture}






      tikz-pgf graphs






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 10 hours ago









      Drimades Boy

      385




      385






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          4
          down vote



          accepted










          According to what I find, the perhaps most straightforward way of achieving this is to employ pics.



          documentclass[tikz,border=3.14mm]{standalone}
          usetikzlibrary{decorations.fractals}
          tikzset{pics/.cd,
          snowflake/.style n args={2}{code={%
          begin{scope}[decoration=Koch snowflake]
          draw[#1] decorate{decorate{decorate{decorate{(-1.5,1) -- (1.5,1)}}}};
          draw[#1] decorate{decorate{decorate{decorate{(1.5,1) -- (0,-2)}}}};
          draw[#1] decorate{decorate{decorate{decorate{(0,-2) -- (-1.5,1)}}}};
          path[#1] (-1.5,1) -- (1.5,1) -- (0,-2);
          node at (0,0) {#2};
          end{scope}}}}
          begin{document}
          begin{tikzpicture}[scale=.6,auto=right]
          pic[local bounding box=n6,scale=0.3] at (31,20) {snowflake={fill=yellow}{6}};
          pic[local bounding box=n4,scale=0.3] at (34,18) {snowflake={fill=yellow}{4}};
          pic[local bounding box=n5,scale=0.3] at (38,19) {snowflake={fill=yellow}{5}};
          pic[local bounding box=n1,scale=0.3] at (41,18) {snowflake={fill=yellow}{1}};
          pic[local bounding box=n2,scale=0.3] at (39,16) {snowflake={fill=yellow}{2}};
          pic[local bounding box=n3,scale=0.3] at (35,15) {snowflake={fill=yellow}{3}};

          foreach from/to in {n6/n4,n4/n5,n5/n1,n1/n2,n2/n5,n2/n3,n3/n4}
          draw (from) -- (to);

          end{tikzpicture}
          end{document}


          enter image description here



          The cleanest way would probably be to define a new shape. Given the complexity of the shape, this might not be straightforward, but it is conceivable that it is not impossible. Another option would be to use a path picture of a node, but like in the pics above that would "only" lead to background pictures and in particular not define the boundary of the nodes, meaning that the gaps in the lines connecting the snow flakes would be similar to above. (They may become slightly smaller if you base the node on a circle shape, but path pictures have other subtleties which is why I removed this part of my earlier answer.)



          Note that, if you are concerned about the gaps in the lines connecting the nodes, there is a simple fix.



          documentclass[tikz,border=3.14mm]{standalone}
          usetikzlibrary{decorations.fractals,backgrounds}
          tikzset{pics/.cd,
          snowflake/.style n args={2}{code={%
          begin{scope}[decoration=Koch snowflake]
          draw[#1] decorate{decorate{decorate{decorate{(-1.5,1) -- (1.5,1)}}}};
          draw[#1] decorate{decorate{decorate{decorate{(1.5,1) -- (0,-2)}}}};
          draw[#1] decorate{decorate{decorate{decorate{(0,-2) -- (-1.5,1)}}}};
          path[#1] (-1.5,1) -- (1.5,1) -- (0,-2);
          node at (0,0) {#2};
          end{scope}}}}
          begin{document}
          begin{tikzpicture}[scale=.6,auto=right]
          pic[local bounding box=n6,scale=0.3] at (31,20) {snowflake={fill=yellow}{6}};
          pic[local bounding box=n4,scale=0.3] at (34,18) {snowflake={fill=yellow}{4}};
          pic[local bounding box=n5,scale=0.3] at (38,19) {snowflake={fill=yellow}{5}};
          pic[local bounding box=n1,scale=0.3] at (41,18) {snowflake={fill=yellow}{1}};
          pic[local bounding box=n2,scale=0.3] at (39,16) {snowflake={fill=yellow}{2}};
          pic[local bounding box=n3,scale=0.3] at (35,15) {snowflake={fill=yellow}{3}};
          begin{scope}[on background layer]
          foreach from/to in {n6/n4,n4/n5,n5/n1,n1/n2,n2/n5,n2/n3,n3/n4}
          draw (from.center) -- (to.center);
          end{scope}
          end{tikzpicture}
          end{document}


          enter image description here



          I am, of course, not claiming that the lines hit the "nodes" precisely in the same way as pgfpointshapeborder would, but since these snow flakes are sort of spherical, it almost works.






          share|improve this answer























            Your Answer








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

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

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            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
            });


            }
            });














             

            draft saved


            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f462059%2fcustomized-node-of-graph-in-tikz%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            4
            down vote



            accepted










            According to what I find, the perhaps most straightforward way of achieving this is to employ pics.



            documentclass[tikz,border=3.14mm]{standalone}
            usetikzlibrary{decorations.fractals}
            tikzset{pics/.cd,
            snowflake/.style n args={2}{code={%
            begin{scope}[decoration=Koch snowflake]
            draw[#1] decorate{decorate{decorate{decorate{(-1.5,1) -- (1.5,1)}}}};
            draw[#1] decorate{decorate{decorate{decorate{(1.5,1) -- (0,-2)}}}};
            draw[#1] decorate{decorate{decorate{decorate{(0,-2) -- (-1.5,1)}}}};
            path[#1] (-1.5,1) -- (1.5,1) -- (0,-2);
            node at (0,0) {#2};
            end{scope}}}}
            begin{document}
            begin{tikzpicture}[scale=.6,auto=right]
            pic[local bounding box=n6,scale=0.3] at (31,20) {snowflake={fill=yellow}{6}};
            pic[local bounding box=n4,scale=0.3] at (34,18) {snowflake={fill=yellow}{4}};
            pic[local bounding box=n5,scale=0.3] at (38,19) {snowflake={fill=yellow}{5}};
            pic[local bounding box=n1,scale=0.3] at (41,18) {snowflake={fill=yellow}{1}};
            pic[local bounding box=n2,scale=0.3] at (39,16) {snowflake={fill=yellow}{2}};
            pic[local bounding box=n3,scale=0.3] at (35,15) {snowflake={fill=yellow}{3}};

            foreach from/to in {n6/n4,n4/n5,n5/n1,n1/n2,n2/n5,n2/n3,n3/n4}
            draw (from) -- (to);

            end{tikzpicture}
            end{document}


            enter image description here



            The cleanest way would probably be to define a new shape. Given the complexity of the shape, this might not be straightforward, but it is conceivable that it is not impossible. Another option would be to use a path picture of a node, but like in the pics above that would "only" lead to background pictures and in particular not define the boundary of the nodes, meaning that the gaps in the lines connecting the snow flakes would be similar to above. (They may become slightly smaller if you base the node on a circle shape, but path pictures have other subtleties which is why I removed this part of my earlier answer.)



            Note that, if you are concerned about the gaps in the lines connecting the nodes, there is a simple fix.



            documentclass[tikz,border=3.14mm]{standalone}
            usetikzlibrary{decorations.fractals,backgrounds}
            tikzset{pics/.cd,
            snowflake/.style n args={2}{code={%
            begin{scope}[decoration=Koch snowflake]
            draw[#1] decorate{decorate{decorate{decorate{(-1.5,1) -- (1.5,1)}}}};
            draw[#1] decorate{decorate{decorate{decorate{(1.5,1) -- (0,-2)}}}};
            draw[#1] decorate{decorate{decorate{decorate{(0,-2) -- (-1.5,1)}}}};
            path[#1] (-1.5,1) -- (1.5,1) -- (0,-2);
            node at (0,0) {#2};
            end{scope}}}}
            begin{document}
            begin{tikzpicture}[scale=.6,auto=right]
            pic[local bounding box=n6,scale=0.3] at (31,20) {snowflake={fill=yellow}{6}};
            pic[local bounding box=n4,scale=0.3] at (34,18) {snowflake={fill=yellow}{4}};
            pic[local bounding box=n5,scale=0.3] at (38,19) {snowflake={fill=yellow}{5}};
            pic[local bounding box=n1,scale=0.3] at (41,18) {snowflake={fill=yellow}{1}};
            pic[local bounding box=n2,scale=0.3] at (39,16) {snowflake={fill=yellow}{2}};
            pic[local bounding box=n3,scale=0.3] at (35,15) {snowflake={fill=yellow}{3}};
            begin{scope}[on background layer]
            foreach from/to in {n6/n4,n4/n5,n5/n1,n1/n2,n2/n5,n2/n3,n3/n4}
            draw (from.center) -- (to.center);
            end{scope}
            end{tikzpicture}
            end{document}


            enter image description here



            I am, of course, not claiming that the lines hit the "nodes" precisely in the same way as pgfpointshapeborder would, but since these snow flakes are sort of spherical, it almost works.






            share|improve this answer



























              up vote
              4
              down vote



              accepted










              According to what I find, the perhaps most straightforward way of achieving this is to employ pics.



              documentclass[tikz,border=3.14mm]{standalone}
              usetikzlibrary{decorations.fractals}
              tikzset{pics/.cd,
              snowflake/.style n args={2}{code={%
              begin{scope}[decoration=Koch snowflake]
              draw[#1] decorate{decorate{decorate{decorate{(-1.5,1) -- (1.5,1)}}}};
              draw[#1] decorate{decorate{decorate{decorate{(1.5,1) -- (0,-2)}}}};
              draw[#1] decorate{decorate{decorate{decorate{(0,-2) -- (-1.5,1)}}}};
              path[#1] (-1.5,1) -- (1.5,1) -- (0,-2);
              node at (0,0) {#2};
              end{scope}}}}
              begin{document}
              begin{tikzpicture}[scale=.6,auto=right]
              pic[local bounding box=n6,scale=0.3] at (31,20) {snowflake={fill=yellow}{6}};
              pic[local bounding box=n4,scale=0.3] at (34,18) {snowflake={fill=yellow}{4}};
              pic[local bounding box=n5,scale=0.3] at (38,19) {snowflake={fill=yellow}{5}};
              pic[local bounding box=n1,scale=0.3] at (41,18) {snowflake={fill=yellow}{1}};
              pic[local bounding box=n2,scale=0.3] at (39,16) {snowflake={fill=yellow}{2}};
              pic[local bounding box=n3,scale=0.3] at (35,15) {snowflake={fill=yellow}{3}};

              foreach from/to in {n6/n4,n4/n5,n5/n1,n1/n2,n2/n5,n2/n3,n3/n4}
              draw (from) -- (to);

              end{tikzpicture}
              end{document}


              enter image description here



              The cleanest way would probably be to define a new shape. Given the complexity of the shape, this might not be straightforward, but it is conceivable that it is not impossible. Another option would be to use a path picture of a node, but like in the pics above that would "only" lead to background pictures and in particular not define the boundary of the nodes, meaning that the gaps in the lines connecting the snow flakes would be similar to above. (They may become slightly smaller if you base the node on a circle shape, but path pictures have other subtleties which is why I removed this part of my earlier answer.)



              Note that, if you are concerned about the gaps in the lines connecting the nodes, there is a simple fix.



              documentclass[tikz,border=3.14mm]{standalone}
              usetikzlibrary{decorations.fractals,backgrounds}
              tikzset{pics/.cd,
              snowflake/.style n args={2}{code={%
              begin{scope}[decoration=Koch snowflake]
              draw[#1] decorate{decorate{decorate{decorate{(-1.5,1) -- (1.5,1)}}}};
              draw[#1] decorate{decorate{decorate{decorate{(1.5,1) -- (0,-2)}}}};
              draw[#1] decorate{decorate{decorate{decorate{(0,-2) -- (-1.5,1)}}}};
              path[#1] (-1.5,1) -- (1.5,1) -- (0,-2);
              node at (0,0) {#2};
              end{scope}}}}
              begin{document}
              begin{tikzpicture}[scale=.6,auto=right]
              pic[local bounding box=n6,scale=0.3] at (31,20) {snowflake={fill=yellow}{6}};
              pic[local bounding box=n4,scale=0.3] at (34,18) {snowflake={fill=yellow}{4}};
              pic[local bounding box=n5,scale=0.3] at (38,19) {snowflake={fill=yellow}{5}};
              pic[local bounding box=n1,scale=0.3] at (41,18) {snowflake={fill=yellow}{1}};
              pic[local bounding box=n2,scale=0.3] at (39,16) {snowflake={fill=yellow}{2}};
              pic[local bounding box=n3,scale=0.3] at (35,15) {snowflake={fill=yellow}{3}};
              begin{scope}[on background layer]
              foreach from/to in {n6/n4,n4/n5,n5/n1,n1/n2,n2/n5,n2/n3,n3/n4}
              draw (from.center) -- (to.center);
              end{scope}
              end{tikzpicture}
              end{document}


              enter image description here



              I am, of course, not claiming that the lines hit the "nodes" precisely in the same way as pgfpointshapeborder would, but since these snow flakes are sort of spherical, it almost works.






              share|improve this answer

























                up vote
                4
                down vote



                accepted







                up vote
                4
                down vote



                accepted






                According to what I find, the perhaps most straightforward way of achieving this is to employ pics.



                documentclass[tikz,border=3.14mm]{standalone}
                usetikzlibrary{decorations.fractals}
                tikzset{pics/.cd,
                snowflake/.style n args={2}{code={%
                begin{scope}[decoration=Koch snowflake]
                draw[#1] decorate{decorate{decorate{decorate{(-1.5,1) -- (1.5,1)}}}};
                draw[#1] decorate{decorate{decorate{decorate{(1.5,1) -- (0,-2)}}}};
                draw[#1] decorate{decorate{decorate{decorate{(0,-2) -- (-1.5,1)}}}};
                path[#1] (-1.5,1) -- (1.5,1) -- (0,-2);
                node at (0,0) {#2};
                end{scope}}}}
                begin{document}
                begin{tikzpicture}[scale=.6,auto=right]
                pic[local bounding box=n6,scale=0.3] at (31,20) {snowflake={fill=yellow}{6}};
                pic[local bounding box=n4,scale=0.3] at (34,18) {snowflake={fill=yellow}{4}};
                pic[local bounding box=n5,scale=0.3] at (38,19) {snowflake={fill=yellow}{5}};
                pic[local bounding box=n1,scale=0.3] at (41,18) {snowflake={fill=yellow}{1}};
                pic[local bounding box=n2,scale=0.3] at (39,16) {snowflake={fill=yellow}{2}};
                pic[local bounding box=n3,scale=0.3] at (35,15) {snowflake={fill=yellow}{3}};

                foreach from/to in {n6/n4,n4/n5,n5/n1,n1/n2,n2/n5,n2/n3,n3/n4}
                draw (from) -- (to);

                end{tikzpicture}
                end{document}


                enter image description here



                The cleanest way would probably be to define a new shape. Given the complexity of the shape, this might not be straightforward, but it is conceivable that it is not impossible. Another option would be to use a path picture of a node, but like in the pics above that would "only" lead to background pictures and in particular not define the boundary of the nodes, meaning that the gaps in the lines connecting the snow flakes would be similar to above. (They may become slightly smaller if you base the node on a circle shape, but path pictures have other subtleties which is why I removed this part of my earlier answer.)



                Note that, if you are concerned about the gaps in the lines connecting the nodes, there is a simple fix.



                documentclass[tikz,border=3.14mm]{standalone}
                usetikzlibrary{decorations.fractals,backgrounds}
                tikzset{pics/.cd,
                snowflake/.style n args={2}{code={%
                begin{scope}[decoration=Koch snowflake]
                draw[#1] decorate{decorate{decorate{decorate{(-1.5,1) -- (1.5,1)}}}};
                draw[#1] decorate{decorate{decorate{decorate{(1.5,1) -- (0,-2)}}}};
                draw[#1] decorate{decorate{decorate{decorate{(0,-2) -- (-1.5,1)}}}};
                path[#1] (-1.5,1) -- (1.5,1) -- (0,-2);
                node at (0,0) {#2};
                end{scope}}}}
                begin{document}
                begin{tikzpicture}[scale=.6,auto=right]
                pic[local bounding box=n6,scale=0.3] at (31,20) {snowflake={fill=yellow}{6}};
                pic[local bounding box=n4,scale=0.3] at (34,18) {snowflake={fill=yellow}{4}};
                pic[local bounding box=n5,scale=0.3] at (38,19) {snowflake={fill=yellow}{5}};
                pic[local bounding box=n1,scale=0.3] at (41,18) {snowflake={fill=yellow}{1}};
                pic[local bounding box=n2,scale=0.3] at (39,16) {snowflake={fill=yellow}{2}};
                pic[local bounding box=n3,scale=0.3] at (35,15) {snowflake={fill=yellow}{3}};
                begin{scope}[on background layer]
                foreach from/to in {n6/n4,n4/n5,n5/n1,n1/n2,n2/n5,n2/n3,n3/n4}
                draw (from.center) -- (to.center);
                end{scope}
                end{tikzpicture}
                end{document}


                enter image description here



                I am, of course, not claiming that the lines hit the "nodes" precisely in the same way as pgfpointshapeborder would, but since these snow flakes are sort of spherical, it almost works.






                share|improve this answer














                According to what I find, the perhaps most straightforward way of achieving this is to employ pics.



                documentclass[tikz,border=3.14mm]{standalone}
                usetikzlibrary{decorations.fractals}
                tikzset{pics/.cd,
                snowflake/.style n args={2}{code={%
                begin{scope}[decoration=Koch snowflake]
                draw[#1] decorate{decorate{decorate{decorate{(-1.5,1) -- (1.5,1)}}}};
                draw[#1] decorate{decorate{decorate{decorate{(1.5,1) -- (0,-2)}}}};
                draw[#1] decorate{decorate{decorate{decorate{(0,-2) -- (-1.5,1)}}}};
                path[#1] (-1.5,1) -- (1.5,1) -- (0,-2);
                node at (0,0) {#2};
                end{scope}}}}
                begin{document}
                begin{tikzpicture}[scale=.6,auto=right]
                pic[local bounding box=n6,scale=0.3] at (31,20) {snowflake={fill=yellow}{6}};
                pic[local bounding box=n4,scale=0.3] at (34,18) {snowflake={fill=yellow}{4}};
                pic[local bounding box=n5,scale=0.3] at (38,19) {snowflake={fill=yellow}{5}};
                pic[local bounding box=n1,scale=0.3] at (41,18) {snowflake={fill=yellow}{1}};
                pic[local bounding box=n2,scale=0.3] at (39,16) {snowflake={fill=yellow}{2}};
                pic[local bounding box=n3,scale=0.3] at (35,15) {snowflake={fill=yellow}{3}};

                foreach from/to in {n6/n4,n4/n5,n5/n1,n1/n2,n2/n5,n2/n3,n3/n4}
                draw (from) -- (to);

                end{tikzpicture}
                end{document}


                enter image description here



                The cleanest way would probably be to define a new shape. Given the complexity of the shape, this might not be straightforward, but it is conceivable that it is not impossible. Another option would be to use a path picture of a node, but like in the pics above that would "only" lead to background pictures and in particular not define the boundary of the nodes, meaning that the gaps in the lines connecting the snow flakes would be similar to above. (They may become slightly smaller if you base the node on a circle shape, but path pictures have other subtleties which is why I removed this part of my earlier answer.)



                Note that, if you are concerned about the gaps in the lines connecting the nodes, there is a simple fix.



                documentclass[tikz,border=3.14mm]{standalone}
                usetikzlibrary{decorations.fractals,backgrounds}
                tikzset{pics/.cd,
                snowflake/.style n args={2}{code={%
                begin{scope}[decoration=Koch snowflake]
                draw[#1] decorate{decorate{decorate{decorate{(-1.5,1) -- (1.5,1)}}}};
                draw[#1] decorate{decorate{decorate{decorate{(1.5,1) -- (0,-2)}}}};
                draw[#1] decorate{decorate{decorate{decorate{(0,-2) -- (-1.5,1)}}}};
                path[#1] (-1.5,1) -- (1.5,1) -- (0,-2);
                node at (0,0) {#2};
                end{scope}}}}
                begin{document}
                begin{tikzpicture}[scale=.6,auto=right]
                pic[local bounding box=n6,scale=0.3] at (31,20) {snowflake={fill=yellow}{6}};
                pic[local bounding box=n4,scale=0.3] at (34,18) {snowflake={fill=yellow}{4}};
                pic[local bounding box=n5,scale=0.3] at (38,19) {snowflake={fill=yellow}{5}};
                pic[local bounding box=n1,scale=0.3] at (41,18) {snowflake={fill=yellow}{1}};
                pic[local bounding box=n2,scale=0.3] at (39,16) {snowflake={fill=yellow}{2}};
                pic[local bounding box=n3,scale=0.3] at (35,15) {snowflake={fill=yellow}{3}};
                begin{scope}[on background layer]
                foreach from/to in {n6/n4,n4/n5,n5/n1,n1/n2,n2/n5,n2/n3,n3/n4}
                draw (from.center) -- (to.center);
                end{scope}
                end{tikzpicture}
                end{document}


                enter image description here



                I am, of course, not claiming that the lines hit the "nodes" precisely in the same way as pgfpointshapeborder would, but since these snow flakes are sort of spherical, it almost works.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited 5 hours ago

























                answered 9 hours ago









                marmot

                78.6k487166




                78.6k487166






























                     

                    draft saved


                    draft discarded



















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f462059%2fcustomized-node-of-graph-in-tikz%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    サソリ

                    広島県道265号伴広島線

                    Accessing regular linux commands in Huawei's Dopra Linux