Randomly curved arrows in TikZ

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP












10















Any suggestions on how to draw something like this picture using TikZ?



Thanks!



enter image description here










share|improve this question




























    10















    Any suggestions on how to draw something like this picture using TikZ?



    Thanks!



    enter image description here










    share|improve this question


























      10












      10








      10


      2






      Any suggestions on how to draw something like this picture using TikZ?



      Thanks!



      enter image description here










      share|improve this question
















      Any suggestions on how to draw something like this picture using TikZ?



      Thanks!



      enter image description here







      tikz-pgf arrows random






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 21 at 22:15









      Milo

      6,36721650




      6,36721650










      asked Jan 21 at 21:14









      sorciottosorciotto

      605




      605




















          2 Answers
          2






          active

          oldest

          votes


















          16














          Here is a slight extension of Milo's nice answer. The main differences (improvements?) are:



          1. I rewrote Alain Matthes' nice answer to allow for arbitrary functions determining the line width. Previously it was a linearly dependence, now it can be an arbitrary function such as a sine. All you need to do is to say declare function=varyinglw(x)=1+6*sin(1.8*x);. Apart from that, I made the code a bit more general, increased its speed (I think) and got rid of makeatletter since there was nothing that cannot be achieved with commands not containing @s.

          2. This variation also does not nest tikzpictures. Rather, the arrows a re attached in the usual way, and can be even bent.

          Here's how this works



          • You need to find a function that determines how thick the line is at a given position of the path. This function has the name varyinglw. It's argument runs from 0 to 100. So if the function has a maximum at 50, the path will have reached its maximal width in the middle. An example for a function with this feature is declare function=varyinglw(x)=1+6*sin(1.8*x); below. If you want to use different functions, use scopes. Unfortunately I do not now how one can reset functions that are declared with declare functions. Therefore you should keep your functions local.

          • If you have a very long path, you may want to increase the number of segments since otherwise it won't look smooth any more. This can be done by saying e.g. /pgf/decoration/varying line width steps=180 as in the examples below.

          • Other than that you can use pretty much any path.



          documentclass[tikz,border=3.14mm]standalone
          usetikzlibrarydecorations,arrows.meta,bending
          begindocument

          pgfkeys/pgf/decoration/.cd,
          start color/.store in=startcolor,
          start color=black,
          end color/.store in=endcolor,
          end color=black,
          varying line width steps/.initial=100

          pgfdeclaredecorationwidth and color changeinitial
          stateinitial[width=0pt, next state=line, persistent precomputation=%
          pgfmathparsepgfdecoratedpathlength/pgfkeysvalueof/pgf/decoration/varying line width steps%
          letincrement=pgfmathresult%
          defx0%
          ]
          stateline[width=increment pt, persistent postcomputation=%
          pgfmathsetmacroxx+increment
          ,next state=line]%
          pgfmathparseifthenelse(x<pgfdecoratedpathlength-5mm,varyinglw(100*(x/pgfdecoratedpathlength)),
          varyinglw(100*((pgfdecoratedpathlength-5mm)/pgfdecoratedpathlength))*(pgfdecoratedpathlength-x)/14) )
          pgfsetlinewidthpgfmathresult pt%
          pgfpathmovetopgfpointorigin%
          pgfmathsetmacrosteplength1.4*increment
          pgfpathlinetopgfqpointsteplength pt0pt%
          pgfmathsetmacroy100*(x/pgfdecoratedpathlength)
          pgfsetstrokecolorendcolor!y!startcolor%
          pgfusepathstroke%

          statefinal%
          pgfsetlinewidthpgflinewidth%
          pgfpathmovetopgfpointorigin%
          pgfmathsetmacroy100*(x/pgfdecoratedpathlength)
          colorendcolor!y!startcolor%
          pgfusepathstroke%




          begintikzpicture[varying arrow/.style=-Stealth[length=5mm,width=3.2mm,bend],color=endcolor,
          postaction=/utils/exec=pgfsetarrows-,decorate,decoration=width and color change
          ]
          beginscope[declare function=varyinglw(x)=1+6*sin(1.8*x);]
          draw[varying arrow] (0,0) to[out=45,in=150] ++ (1.5,0) to[out=-30,in=-135] ++ (3,0);
          draw[varying arrow,/pgf/decoration/varying line width steps=180]
          (0,-3) to[out=45,in=150] ++ (1.5,0) to[out=-30,in=-135] ++ (3,0)
          to[out=45,in=45] ++ (-2,1);
          draw[varying arrow,/pgf/decoration/varying line width steps=180,
          /pgf/decoration/start color=red,/pgf/decoration/end color=blue]
          (0,-5) to[out=15,in=165] ++ (2,0) to[out=-15,in=90] ++ (1,-1)
          to[out=-90,in=-20] ++ (-1.5,0);
          endscope

          beginscope[declare function=varyinglw(x)=4-3*cos(7.2*x);,xshift=6cm]
          draw[varying arrow] (0,0) to[out=45,in=150] ++ (1.5,0) to[out=-30,in=-135] ++ (3,0);
          draw[varying arrow,/pgf/decoration/varying line width steps=180]
          (0,-3) to[out=45,in=150] ++ (1.5,0) to[out=-30,in=-135] ++ (3,0)
          to[out=45,in=45] ++ (-2,1);
          draw[varying arrow,/pgf/decoration/varying line width steps=180,
          /pgf/decoration/start color=yellow,/pgf/decoration/end color=red]
          (0,-5) to[out=15,in=165] ++ (2,0) to[out=-15,in=90] ++ (1,-1)
          to[out=-90,in=-20] ++ (-1.5,0);
          endscope

          beginscope[declare function=varyinglw(x)=4-3*cos(5.6*x);,xshift=12cm]
          draw[varying arrow] (0,0) to[out=45,in=150] ++ (1.5,0) to[out=-30,in=-135] ++ (3,0);
          draw[varying arrow,/pgf/decoration/varying line width steps=180]
          (0,-3) to[out=45,in=150] ++ (1.5,0) to[out=-30,in=-135] ++ (3,0)
          to[out=45,in=45] ++ (-2,1);
          draw[varying arrow,/pgf/decoration/varying line width steps=180,
          /pgf/decoration/start color=yellow,/pgf/decoration/end color=blue]
          (0,-5) to[out=15,in=165] ++ (2,0) to[out=-15,in=90] ++ (1,-1)
          to[out=-90,in=-20] ++ (-1.5,0);
          endscope
          endtikzpicture
          enddocument


          enter image description here



          FUN: The mandatory animation.



          documentclass[tikz,border=3.14mm]standalone
          usetikzlibrarydecorations,arrows.meta,bending
          begindocument

          pgfkeys/pgf/decoration/.cd,
          start color/.store in=startcolor,
          start color=black,
          end color/.store in=endcolor,
          end color=black,
          varying line width steps/.initial=100

          pgfdeclaredecorationwidth and color changeinitial
          stateinitial[width=0pt, next state=line, persistent precomputation=%
          pgfmathparsepgfdecoratedpathlength/pgfkeysvalueof/pgf/decoration/varying line width steps%
          letincrement=pgfmathresult%
          defx0%
          ]
          stateline[width=increment pt, persistent postcomputation=%
          pgfmathsetmacroxx+increment
          ,next state=line]%
          pgfmathparseifthenelse(x<pgfdecoratedpathlength-5mm,varyinglw(100*(x/pgfdecoratedpathlength)),
          varyinglw(100*((pgfdecoratedpathlength-5mm)/pgfdecoratedpathlength))*(pgfdecoratedpathlength-x)/14) )
          pgfsetlinewidthpgfmathresult pt%
          pgfpathmovetopgfpointorigin%
          pgfmathsetmacrosteplength1.4*increment
          pgfpathlinetopgfqpointsteplength pt0pt%
          pgfmathsetmacroy100*(x/pgfdecoratedpathlength)
          pgfsetstrokecolorendcolor!y!startcolor%
          pgfusepathstroke%

          statefinal%
          pgfsetlinewidthpgflinewidth%
          pgfpathmovetopgfpointorigin%
          pgfmathsetmacroy100*(x/pgfdecoratedpathlength)
          colorendcolor!y!startcolor%
          pgfusepathstroke%



          foreach Z in 0,10,...,720
          begintikzpicture[varying arrow/.style=-Stealth[length=5mm,width=3.2mm,bend],color=endcolor,
          postaction=/utils/exec=pgfsetarrows-,decorate,decoration=width and color change
          ]
          path[use as bounding box] (-4,-4) rectangle (4,4);
          beginscope[declare function=varyinglw(x)=1+6*sin(1.8*x);]
          draw[varying arrow] plot[variable=z,domain=Z+90:Z+180]
          (z:1+sqrt(z/90));
          endscope

          endtikzpicture
          enddocument


          enter image description here



          ALTERNATIVE: Some additional possibilities arise with the calligraphy library. (If I understand correctly, currently you need to download the latest version from this repository.)



          documentclass[tikz,border=3.14mm]standalone
          usepackagespath3
          usetikzlibrarycalligraphy % need to download the repository from https://github.com/loopspace/spath3
          % run "tex spath3.dtx" and then copy the spath3.sty file in the same directory
          % as the tex file
          usetikzlibraryarrows.meta,bending,decorations.pathreplacing
          tikzsetcalligraph/.style=postaction=decorate,decoration=show path construction,
          moveto code=,
          lineto code=,
          curveto code=
          calligraphy (tikzinputsegmentfirst) .. controls
          (tikzinputsegmentsupporta) and (tikzinputsegmentsupportb)
          ..(tikzinputsegmentlast);
          ,
          closepath code=

          begindocument
          begintikzpicture[line width=1pt]
          pen (-135:.125) -- (45:.125) ;
          draw[calligraph,Stealth[length=5mm,width=3.2mm,bend]-] (0,0) to[out=45,in=150] ++ (1.5,0) to[out=-30,in=-135] ++ (3,0);
          endtikzpicture

          begintikzpicture[line width=1pt]
          pen (-135:.125) -- (45:.125) ;
          draw[calligraph,Stealth[length=5mm,width=3.2mm,bend]-] (0,0) to[out=45,in=150]
          ++ (1.5,0) to[out=-30,in=45] ++ (1,-2);
          endtikzpicture
          enddocument


          enter image description here






          share|improve this answer
































            16














            This isn't a complete answer. But as a proof of concept, I tried adapting this answer from Stroke with variable thickness to make something like the arrows you want.



            enter image description here



            documentclass[tikz,margin=0.5cm]standalone
            usetikzlibrarydecorations,arrows.meta

            makeatletter
            pgfkeys/pgf/decoration/.cd,
            start color/.store in =startcolor,
            end color/.store in =endcolor

            pgfdeclaredecorationwidth and color changeinitial
            stateinitial[width=2pt, next state=line, persistent precomputation=%
            pgfmathdivide50pgfdecoratedpathlength%
            letincrement=pgfmathresult%
            defx0%
            ]
            stateline[width=.5pt, persistent postcomputation=%
            pgfmathadd@xincrement%
            letx=pgfmathresult%
            ]%
            pgfsetlinewidthx/20*0.005pt+pgflinewidth%
            pgfsetarrows-%
            pgfpathmovetopgfpointorigin%
            pgfpathlinetopgfqpoint.75pt0pt%
            pgfsetstrokecolorendcolor!x!startcolor%
            pgfusepathstroke%

            statefinal%
            pgfsetlinewidthpgflinewidth%
            pgfpathmovetopgfpointorigin%
            colorendcolor!x!startcolor%
            pgfusepathstroke%


            makeatother

            begindocument

            begintikzpicture

            draw [line width=2pt, decoration=width and color change,start color=black, end color=black, decorate,] plot [smooth, tension=1] coordinates (0,0) (2,0.5) (5,0.7) (3,1.5) (1,1.5) node [rotate=100] tikz draw [-Stealth[length=7mm, width=10mm]](0,0); ;

            endtikzpicture

            enddocument





            share|improve this answer


















            • 4





              @marmot I'm actually thinking about forbidding nesting in a future version of PGF. It's just not fixable and always calls for trouble.

              – Henri Menke
              Jan 22 at 1:26











            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
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f471204%2frandomly-curved-arrows-in-tikz%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









            16














            Here is a slight extension of Milo's nice answer. The main differences (improvements?) are:



            1. I rewrote Alain Matthes' nice answer to allow for arbitrary functions determining the line width. Previously it was a linearly dependence, now it can be an arbitrary function such as a sine. All you need to do is to say declare function=varyinglw(x)=1+6*sin(1.8*x);. Apart from that, I made the code a bit more general, increased its speed (I think) and got rid of makeatletter since there was nothing that cannot be achieved with commands not containing @s.

            2. This variation also does not nest tikzpictures. Rather, the arrows a re attached in the usual way, and can be even bent.

            Here's how this works



            • You need to find a function that determines how thick the line is at a given position of the path. This function has the name varyinglw. It's argument runs from 0 to 100. So if the function has a maximum at 50, the path will have reached its maximal width in the middle. An example for a function with this feature is declare function=varyinglw(x)=1+6*sin(1.8*x); below. If you want to use different functions, use scopes. Unfortunately I do not now how one can reset functions that are declared with declare functions. Therefore you should keep your functions local.

            • If you have a very long path, you may want to increase the number of segments since otherwise it won't look smooth any more. This can be done by saying e.g. /pgf/decoration/varying line width steps=180 as in the examples below.

            • Other than that you can use pretty much any path.



            documentclass[tikz,border=3.14mm]standalone
            usetikzlibrarydecorations,arrows.meta,bending
            begindocument

            pgfkeys/pgf/decoration/.cd,
            start color/.store in=startcolor,
            start color=black,
            end color/.store in=endcolor,
            end color=black,
            varying line width steps/.initial=100

            pgfdeclaredecorationwidth and color changeinitial
            stateinitial[width=0pt, next state=line, persistent precomputation=%
            pgfmathparsepgfdecoratedpathlength/pgfkeysvalueof/pgf/decoration/varying line width steps%
            letincrement=pgfmathresult%
            defx0%
            ]
            stateline[width=increment pt, persistent postcomputation=%
            pgfmathsetmacroxx+increment
            ,next state=line]%
            pgfmathparseifthenelse(x<pgfdecoratedpathlength-5mm,varyinglw(100*(x/pgfdecoratedpathlength)),
            varyinglw(100*((pgfdecoratedpathlength-5mm)/pgfdecoratedpathlength))*(pgfdecoratedpathlength-x)/14) )
            pgfsetlinewidthpgfmathresult pt%
            pgfpathmovetopgfpointorigin%
            pgfmathsetmacrosteplength1.4*increment
            pgfpathlinetopgfqpointsteplength pt0pt%
            pgfmathsetmacroy100*(x/pgfdecoratedpathlength)
            pgfsetstrokecolorendcolor!y!startcolor%
            pgfusepathstroke%

            statefinal%
            pgfsetlinewidthpgflinewidth%
            pgfpathmovetopgfpointorigin%
            pgfmathsetmacroy100*(x/pgfdecoratedpathlength)
            colorendcolor!y!startcolor%
            pgfusepathstroke%




            begintikzpicture[varying arrow/.style=-Stealth[length=5mm,width=3.2mm,bend],color=endcolor,
            postaction=/utils/exec=pgfsetarrows-,decorate,decoration=width and color change
            ]
            beginscope[declare function=varyinglw(x)=1+6*sin(1.8*x);]
            draw[varying arrow] (0,0) to[out=45,in=150] ++ (1.5,0) to[out=-30,in=-135] ++ (3,0);
            draw[varying arrow,/pgf/decoration/varying line width steps=180]
            (0,-3) to[out=45,in=150] ++ (1.5,0) to[out=-30,in=-135] ++ (3,0)
            to[out=45,in=45] ++ (-2,1);
            draw[varying arrow,/pgf/decoration/varying line width steps=180,
            /pgf/decoration/start color=red,/pgf/decoration/end color=blue]
            (0,-5) to[out=15,in=165] ++ (2,0) to[out=-15,in=90] ++ (1,-1)
            to[out=-90,in=-20] ++ (-1.5,0);
            endscope

            beginscope[declare function=varyinglw(x)=4-3*cos(7.2*x);,xshift=6cm]
            draw[varying arrow] (0,0) to[out=45,in=150] ++ (1.5,0) to[out=-30,in=-135] ++ (3,0);
            draw[varying arrow,/pgf/decoration/varying line width steps=180]
            (0,-3) to[out=45,in=150] ++ (1.5,0) to[out=-30,in=-135] ++ (3,0)
            to[out=45,in=45] ++ (-2,1);
            draw[varying arrow,/pgf/decoration/varying line width steps=180,
            /pgf/decoration/start color=yellow,/pgf/decoration/end color=red]
            (0,-5) to[out=15,in=165] ++ (2,0) to[out=-15,in=90] ++ (1,-1)
            to[out=-90,in=-20] ++ (-1.5,0);
            endscope

            beginscope[declare function=varyinglw(x)=4-3*cos(5.6*x);,xshift=12cm]
            draw[varying arrow] (0,0) to[out=45,in=150] ++ (1.5,0) to[out=-30,in=-135] ++ (3,0);
            draw[varying arrow,/pgf/decoration/varying line width steps=180]
            (0,-3) to[out=45,in=150] ++ (1.5,0) to[out=-30,in=-135] ++ (3,0)
            to[out=45,in=45] ++ (-2,1);
            draw[varying arrow,/pgf/decoration/varying line width steps=180,
            /pgf/decoration/start color=yellow,/pgf/decoration/end color=blue]
            (0,-5) to[out=15,in=165] ++ (2,0) to[out=-15,in=90] ++ (1,-1)
            to[out=-90,in=-20] ++ (-1.5,0);
            endscope
            endtikzpicture
            enddocument


            enter image description here



            FUN: The mandatory animation.



            documentclass[tikz,border=3.14mm]standalone
            usetikzlibrarydecorations,arrows.meta,bending
            begindocument

            pgfkeys/pgf/decoration/.cd,
            start color/.store in=startcolor,
            start color=black,
            end color/.store in=endcolor,
            end color=black,
            varying line width steps/.initial=100

            pgfdeclaredecorationwidth and color changeinitial
            stateinitial[width=0pt, next state=line, persistent precomputation=%
            pgfmathparsepgfdecoratedpathlength/pgfkeysvalueof/pgf/decoration/varying line width steps%
            letincrement=pgfmathresult%
            defx0%
            ]
            stateline[width=increment pt, persistent postcomputation=%
            pgfmathsetmacroxx+increment
            ,next state=line]%
            pgfmathparseifthenelse(x<pgfdecoratedpathlength-5mm,varyinglw(100*(x/pgfdecoratedpathlength)),
            varyinglw(100*((pgfdecoratedpathlength-5mm)/pgfdecoratedpathlength))*(pgfdecoratedpathlength-x)/14) )
            pgfsetlinewidthpgfmathresult pt%
            pgfpathmovetopgfpointorigin%
            pgfmathsetmacrosteplength1.4*increment
            pgfpathlinetopgfqpointsteplength pt0pt%
            pgfmathsetmacroy100*(x/pgfdecoratedpathlength)
            pgfsetstrokecolorendcolor!y!startcolor%
            pgfusepathstroke%

            statefinal%
            pgfsetlinewidthpgflinewidth%
            pgfpathmovetopgfpointorigin%
            pgfmathsetmacroy100*(x/pgfdecoratedpathlength)
            colorendcolor!y!startcolor%
            pgfusepathstroke%



            foreach Z in 0,10,...,720
            begintikzpicture[varying arrow/.style=-Stealth[length=5mm,width=3.2mm,bend],color=endcolor,
            postaction=/utils/exec=pgfsetarrows-,decorate,decoration=width and color change
            ]
            path[use as bounding box] (-4,-4) rectangle (4,4);
            beginscope[declare function=varyinglw(x)=1+6*sin(1.8*x);]
            draw[varying arrow] plot[variable=z,domain=Z+90:Z+180]
            (z:1+sqrt(z/90));
            endscope

            endtikzpicture
            enddocument


            enter image description here



            ALTERNATIVE: Some additional possibilities arise with the calligraphy library. (If I understand correctly, currently you need to download the latest version from this repository.)



            documentclass[tikz,border=3.14mm]standalone
            usepackagespath3
            usetikzlibrarycalligraphy % need to download the repository from https://github.com/loopspace/spath3
            % run "tex spath3.dtx" and then copy the spath3.sty file in the same directory
            % as the tex file
            usetikzlibraryarrows.meta,bending,decorations.pathreplacing
            tikzsetcalligraph/.style=postaction=decorate,decoration=show path construction,
            moveto code=,
            lineto code=,
            curveto code=
            calligraphy (tikzinputsegmentfirst) .. controls
            (tikzinputsegmentsupporta) and (tikzinputsegmentsupportb)
            ..(tikzinputsegmentlast);
            ,
            closepath code=

            begindocument
            begintikzpicture[line width=1pt]
            pen (-135:.125) -- (45:.125) ;
            draw[calligraph,Stealth[length=5mm,width=3.2mm,bend]-] (0,0) to[out=45,in=150] ++ (1.5,0) to[out=-30,in=-135] ++ (3,0);
            endtikzpicture

            begintikzpicture[line width=1pt]
            pen (-135:.125) -- (45:.125) ;
            draw[calligraph,Stealth[length=5mm,width=3.2mm,bend]-] (0,0) to[out=45,in=150]
            ++ (1.5,0) to[out=-30,in=45] ++ (1,-2);
            endtikzpicture
            enddocument


            enter image description here






            share|improve this answer





























              16














              Here is a slight extension of Milo's nice answer. The main differences (improvements?) are:



              1. I rewrote Alain Matthes' nice answer to allow for arbitrary functions determining the line width. Previously it was a linearly dependence, now it can be an arbitrary function such as a sine. All you need to do is to say declare function=varyinglw(x)=1+6*sin(1.8*x);. Apart from that, I made the code a bit more general, increased its speed (I think) and got rid of makeatletter since there was nothing that cannot be achieved with commands not containing @s.

              2. This variation also does not nest tikzpictures. Rather, the arrows a re attached in the usual way, and can be even bent.

              Here's how this works



              • You need to find a function that determines how thick the line is at a given position of the path. This function has the name varyinglw. It's argument runs from 0 to 100. So if the function has a maximum at 50, the path will have reached its maximal width in the middle. An example for a function with this feature is declare function=varyinglw(x)=1+6*sin(1.8*x); below. If you want to use different functions, use scopes. Unfortunately I do not now how one can reset functions that are declared with declare functions. Therefore you should keep your functions local.

              • If you have a very long path, you may want to increase the number of segments since otherwise it won't look smooth any more. This can be done by saying e.g. /pgf/decoration/varying line width steps=180 as in the examples below.

              • Other than that you can use pretty much any path.



              documentclass[tikz,border=3.14mm]standalone
              usetikzlibrarydecorations,arrows.meta,bending
              begindocument

              pgfkeys/pgf/decoration/.cd,
              start color/.store in=startcolor,
              start color=black,
              end color/.store in=endcolor,
              end color=black,
              varying line width steps/.initial=100

              pgfdeclaredecorationwidth and color changeinitial
              stateinitial[width=0pt, next state=line, persistent precomputation=%
              pgfmathparsepgfdecoratedpathlength/pgfkeysvalueof/pgf/decoration/varying line width steps%
              letincrement=pgfmathresult%
              defx0%
              ]
              stateline[width=increment pt, persistent postcomputation=%
              pgfmathsetmacroxx+increment
              ,next state=line]%
              pgfmathparseifthenelse(x<pgfdecoratedpathlength-5mm,varyinglw(100*(x/pgfdecoratedpathlength)),
              varyinglw(100*((pgfdecoratedpathlength-5mm)/pgfdecoratedpathlength))*(pgfdecoratedpathlength-x)/14) )
              pgfsetlinewidthpgfmathresult pt%
              pgfpathmovetopgfpointorigin%
              pgfmathsetmacrosteplength1.4*increment
              pgfpathlinetopgfqpointsteplength pt0pt%
              pgfmathsetmacroy100*(x/pgfdecoratedpathlength)
              pgfsetstrokecolorendcolor!y!startcolor%
              pgfusepathstroke%

              statefinal%
              pgfsetlinewidthpgflinewidth%
              pgfpathmovetopgfpointorigin%
              pgfmathsetmacroy100*(x/pgfdecoratedpathlength)
              colorendcolor!y!startcolor%
              pgfusepathstroke%




              begintikzpicture[varying arrow/.style=-Stealth[length=5mm,width=3.2mm,bend],color=endcolor,
              postaction=/utils/exec=pgfsetarrows-,decorate,decoration=width and color change
              ]
              beginscope[declare function=varyinglw(x)=1+6*sin(1.8*x);]
              draw[varying arrow] (0,0) to[out=45,in=150] ++ (1.5,0) to[out=-30,in=-135] ++ (3,0);
              draw[varying arrow,/pgf/decoration/varying line width steps=180]
              (0,-3) to[out=45,in=150] ++ (1.5,0) to[out=-30,in=-135] ++ (3,0)
              to[out=45,in=45] ++ (-2,1);
              draw[varying arrow,/pgf/decoration/varying line width steps=180,
              /pgf/decoration/start color=red,/pgf/decoration/end color=blue]
              (0,-5) to[out=15,in=165] ++ (2,0) to[out=-15,in=90] ++ (1,-1)
              to[out=-90,in=-20] ++ (-1.5,0);
              endscope

              beginscope[declare function=varyinglw(x)=4-3*cos(7.2*x);,xshift=6cm]
              draw[varying arrow] (0,0) to[out=45,in=150] ++ (1.5,0) to[out=-30,in=-135] ++ (3,0);
              draw[varying arrow,/pgf/decoration/varying line width steps=180]
              (0,-3) to[out=45,in=150] ++ (1.5,0) to[out=-30,in=-135] ++ (3,0)
              to[out=45,in=45] ++ (-2,1);
              draw[varying arrow,/pgf/decoration/varying line width steps=180,
              /pgf/decoration/start color=yellow,/pgf/decoration/end color=red]
              (0,-5) to[out=15,in=165] ++ (2,0) to[out=-15,in=90] ++ (1,-1)
              to[out=-90,in=-20] ++ (-1.5,0);
              endscope

              beginscope[declare function=varyinglw(x)=4-3*cos(5.6*x);,xshift=12cm]
              draw[varying arrow] (0,0) to[out=45,in=150] ++ (1.5,0) to[out=-30,in=-135] ++ (3,0);
              draw[varying arrow,/pgf/decoration/varying line width steps=180]
              (0,-3) to[out=45,in=150] ++ (1.5,0) to[out=-30,in=-135] ++ (3,0)
              to[out=45,in=45] ++ (-2,1);
              draw[varying arrow,/pgf/decoration/varying line width steps=180,
              /pgf/decoration/start color=yellow,/pgf/decoration/end color=blue]
              (0,-5) to[out=15,in=165] ++ (2,0) to[out=-15,in=90] ++ (1,-1)
              to[out=-90,in=-20] ++ (-1.5,0);
              endscope
              endtikzpicture
              enddocument


              enter image description here



              FUN: The mandatory animation.



              documentclass[tikz,border=3.14mm]standalone
              usetikzlibrarydecorations,arrows.meta,bending
              begindocument

              pgfkeys/pgf/decoration/.cd,
              start color/.store in=startcolor,
              start color=black,
              end color/.store in=endcolor,
              end color=black,
              varying line width steps/.initial=100

              pgfdeclaredecorationwidth and color changeinitial
              stateinitial[width=0pt, next state=line, persistent precomputation=%
              pgfmathparsepgfdecoratedpathlength/pgfkeysvalueof/pgf/decoration/varying line width steps%
              letincrement=pgfmathresult%
              defx0%
              ]
              stateline[width=increment pt, persistent postcomputation=%
              pgfmathsetmacroxx+increment
              ,next state=line]%
              pgfmathparseifthenelse(x<pgfdecoratedpathlength-5mm,varyinglw(100*(x/pgfdecoratedpathlength)),
              varyinglw(100*((pgfdecoratedpathlength-5mm)/pgfdecoratedpathlength))*(pgfdecoratedpathlength-x)/14) )
              pgfsetlinewidthpgfmathresult pt%
              pgfpathmovetopgfpointorigin%
              pgfmathsetmacrosteplength1.4*increment
              pgfpathlinetopgfqpointsteplength pt0pt%
              pgfmathsetmacroy100*(x/pgfdecoratedpathlength)
              pgfsetstrokecolorendcolor!y!startcolor%
              pgfusepathstroke%

              statefinal%
              pgfsetlinewidthpgflinewidth%
              pgfpathmovetopgfpointorigin%
              pgfmathsetmacroy100*(x/pgfdecoratedpathlength)
              colorendcolor!y!startcolor%
              pgfusepathstroke%



              foreach Z in 0,10,...,720
              begintikzpicture[varying arrow/.style=-Stealth[length=5mm,width=3.2mm,bend],color=endcolor,
              postaction=/utils/exec=pgfsetarrows-,decorate,decoration=width and color change
              ]
              path[use as bounding box] (-4,-4) rectangle (4,4);
              beginscope[declare function=varyinglw(x)=1+6*sin(1.8*x);]
              draw[varying arrow] plot[variable=z,domain=Z+90:Z+180]
              (z:1+sqrt(z/90));
              endscope

              endtikzpicture
              enddocument


              enter image description here



              ALTERNATIVE: Some additional possibilities arise with the calligraphy library. (If I understand correctly, currently you need to download the latest version from this repository.)



              documentclass[tikz,border=3.14mm]standalone
              usepackagespath3
              usetikzlibrarycalligraphy % need to download the repository from https://github.com/loopspace/spath3
              % run "tex spath3.dtx" and then copy the spath3.sty file in the same directory
              % as the tex file
              usetikzlibraryarrows.meta,bending,decorations.pathreplacing
              tikzsetcalligraph/.style=postaction=decorate,decoration=show path construction,
              moveto code=,
              lineto code=,
              curveto code=
              calligraphy (tikzinputsegmentfirst) .. controls
              (tikzinputsegmentsupporta) and (tikzinputsegmentsupportb)
              ..(tikzinputsegmentlast);
              ,
              closepath code=

              begindocument
              begintikzpicture[line width=1pt]
              pen (-135:.125) -- (45:.125) ;
              draw[calligraph,Stealth[length=5mm,width=3.2mm,bend]-] (0,0) to[out=45,in=150] ++ (1.5,0) to[out=-30,in=-135] ++ (3,0);
              endtikzpicture

              begintikzpicture[line width=1pt]
              pen (-135:.125) -- (45:.125) ;
              draw[calligraph,Stealth[length=5mm,width=3.2mm,bend]-] (0,0) to[out=45,in=150]
              ++ (1.5,0) to[out=-30,in=45] ++ (1,-2);
              endtikzpicture
              enddocument


              enter image description here






              share|improve this answer



























                16












                16








                16







                Here is a slight extension of Milo's nice answer. The main differences (improvements?) are:



                1. I rewrote Alain Matthes' nice answer to allow for arbitrary functions determining the line width. Previously it was a linearly dependence, now it can be an arbitrary function such as a sine. All you need to do is to say declare function=varyinglw(x)=1+6*sin(1.8*x);. Apart from that, I made the code a bit more general, increased its speed (I think) and got rid of makeatletter since there was nothing that cannot be achieved with commands not containing @s.

                2. This variation also does not nest tikzpictures. Rather, the arrows a re attached in the usual way, and can be even bent.

                Here's how this works



                • You need to find a function that determines how thick the line is at a given position of the path. This function has the name varyinglw. It's argument runs from 0 to 100. So if the function has a maximum at 50, the path will have reached its maximal width in the middle. An example for a function with this feature is declare function=varyinglw(x)=1+6*sin(1.8*x); below. If you want to use different functions, use scopes. Unfortunately I do not now how one can reset functions that are declared with declare functions. Therefore you should keep your functions local.

                • If you have a very long path, you may want to increase the number of segments since otherwise it won't look smooth any more. This can be done by saying e.g. /pgf/decoration/varying line width steps=180 as in the examples below.

                • Other than that you can use pretty much any path.



                documentclass[tikz,border=3.14mm]standalone
                usetikzlibrarydecorations,arrows.meta,bending
                begindocument

                pgfkeys/pgf/decoration/.cd,
                start color/.store in=startcolor,
                start color=black,
                end color/.store in=endcolor,
                end color=black,
                varying line width steps/.initial=100

                pgfdeclaredecorationwidth and color changeinitial
                stateinitial[width=0pt, next state=line, persistent precomputation=%
                pgfmathparsepgfdecoratedpathlength/pgfkeysvalueof/pgf/decoration/varying line width steps%
                letincrement=pgfmathresult%
                defx0%
                ]
                stateline[width=increment pt, persistent postcomputation=%
                pgfmathsetmacroxx+increment
                ,next state=line]%
                pgfmathparseifthenelse(x<pgfdecoratedpathlength-5mm,varyinglw(100*(x/pgfdecoratedpathlength)),
                varyinglw(100*((pgfdecoratedpathlength-5mm)/pgfdecoratedpathlength))*(pgfdecoratedpathlength-x)/14) )
                pgfsetlinewidthpgfmathresult pt%
                pgfpathmovetopgfpointorigin%
                pgfmathsetmacrosteplength1.4*increment
                pgfpathlinetopgfqpointsteplength pt0pt%
                pgfmathsetmacroy100*(x/pgfdecoratedpathlength)
                pgfsetstrokecolorendcolor!y!startcolor%
                pgfusepathstroke%

                statefinal%
                pgfsetlinewidthpgflinewidth%
                pgfpathmovetopgfpointorigin%
                pgfmathsetmacroy100*(x/pgfdecoratedpathlength)
                colorendcolor!y!startcolor%
                pgfusepathstroke%




                begintikzpicture[varying arrow/.style=-Stealth[length=5mm,width=3.2mm,bend],color=endcolor,
                postaction=/utils/exec=pgfsetarrows-,decorate,decoration=width and color change
                ]
                beginscope[declare function=varyinglw(x)=1+6*sin(1.8*x);]
                draw[varying arrow] (0,0) to[out=45,in=150] ++ (1.5,0) to[out=-30,in=-135] ++ (3,0);
                draw[varying arrow,/pgf/decoration/varying line width steps=180]
                (0,-3) to[out=45,in=150] ++ (1.5,0) to[out=-30,in=-135] ++ (3,0)
                to[out=45,in=45] ++ (-2,1);
                draw[varying arrow,/pgf/decoration/varying line width steps=180,
                /pgf/decoration/start color=red,/pgf/decoration/end color=blue]
                (0,-5) to[out=15,in=165] ++ (2,0) to[out=-15,in=90] ++ (1,-1)
                to[out=-90,in=-20] ++ (-1.5,0);
                endscope

                beginscope[declare function=varyinglw(x)=4-3*cos(7.2*x);,xshift=6cm]
                draw[varying arrow] (0,0) to[out=45,in=150] ++ (1.5,0) to[out=-30,in=-135] ++ (3,0);
                draw[varying arrow,/pgf/decoration/varying line width steps=180]
                (0,-3) to[out=45,in=150] ++ (1.5,0) to[out=-30,in=-135] ++ (3,0)
                to[out=45,in=45] ++ (-2,1);
                draw[varying arrow,/pgf/decoration/varying line width steps=180,
                /pgf/decoration/start color=yellow,/pgf/decoration/end color=red]
                (0,-5) to[out=15,in=165] ++ (2,0) to[out=-15,in=90] ++ (1,-1)
                to[out=-90,in=-20] ++ (-1.5,0);
                endscope

                beginscope[declare function=varyinglw(x)=4-3*cos(5.6*x);,xshift=12cm]
                draw[varying arrow] (0,0) to[out=45,in=150] ++ (1.5,0) to[out=-30,in=-135] ++ (3,0);
                draw[varying arrow,/pgf/decoration/varying line width steps=180]
                (0,-3) to[out=45,in=150] ++ (1.5,0) to[out=-30,in=-135] ++ (3,0)
                to[out=45,in=45] ++ (-2,1);
                draw[varying arrow,/pgf/decoration/varying line width steps=180,
                /pgf/decoration/start color=yellow,/pgf/decoration/end color=blue]
                (0,-5) to[out=15,in=165] ++ (2,0) to[out=-15,in=90] ++ (1,-1)
                to[out=-90,in=-20] ++ (-1.5,0);
                endscope
                endtikzpicture
                enddocument


                enter image description here



                FUN: The mandatory animation.



                documentclass[tikz,border=3.14mm]standalone
                usetikzlibrarydecorations,arrows.meta,bending
                begindocument

                pgfkeys/pgf/decoration/.cd,
                start color/.store in=startcolor,
                start color=black,
                end color/.store in=endcolor,
                end color=black,
                varying line width steps/.initial=100

                pgfdeclaredecorationwidth and color changeinitial
                stateinitial[width=0pt, next state=line, persistent precomputation=%
                pgfmathparsepgfdecoratedpathlength/pgfkeysvalueof/pgf/decoration/varying line width steps%
                letincrement=pgfmathresult%
                defx0%
                ]
                stateline[width=increment pt, persistent postcomputation=%
                pgfmathsetmacroxx+increment
                ,next state=line]%
                pgfmathparseifthenelse(x<pgfdecoratedpathlength-5mm,varyinglw(100*(x/pgfdecoratedpathlength)),
                varyinglw(100*((pgfdecoratedpathlength-5mm)/pgfdecoratedpathlength))*(pgfdecoratedpathlength-x)/14) )
                pgfsetlinewidthpgfmathresult pt%
                pgfpathmovetopgfpointorigin%
                pgfmathsetmacrosteplength1.4*increment
                pgfpathlinetopgfqpointsteplength pt0pt%
                pgfmathsetmacroy100*(x/pgfdecoratedpathlength)
                pgfsetstrokecolorendcolor!y!startcolor%
                pgfusepathstroke%

                statefinal%
                pgfsetlinewidthpgflinewidth%
                pgfpathmovetopgfpointorigin%
                pgfmathsetmacroy100*(x/pgfdecoratedpathlength)
                colorendcolor!y!startcolor%
                pgfusepathstroke%



                foreach Z in 0,10,...,720
                begintikzpicture[varying arrow/.style=-Stealth[length=5mm,width=3.2mm,bend],color=endcolor,
                postaction=/utils/exec=pgfsetarrows-,decorate,decoration=width and color change
                ]
                path[use as bounding box] (-4,-4) rectangle (4,4);
                beginscope[declare function=varyinglw(x)=1+6*sin(1.8*x);]
                draw[varying arrow] plot[variable=z,domain=Z+90:Z+180]
                (z:1+sqrt(z/90));
                endscope

                endtikzpicture
                enddocument


                enter image description here



                ALTERNATIVE: Some additional possibilities arise with the calligraphy library. (If I understand correctly, currently you need to download the latest version from this repository.)



                documentclass[tikz,border=3.14mm]standalone
                usepackagespath3
                usetikzlibrarycalligraphy % need to download the repository from https://github.com/loopspace/spath3
                % run "tex spath3.dtx" and then copy the spath3.sty file in the same directory
                % as the tex file
                usetikzlibraryarrows.meta,bending,decorations.pathreplacing
                tikzsetcalligraph/.style=postaction=decorate,decoration=show path construction,
                moveto code=,
                lineto code=,
                curveto code=
                calligraphy (tikzinputsegmentfirst) .. controls
                (tikzinputsegmentsupporta) and (tikzinputsegmentsupportb)
                ..(tikzinputsegmentlast);
                ,
                closepath code=

                begindocument
                begintikzpicture[line width=1pt]
                pen (-135:.125) -- (45:.125) ;
                draw[calligraph,Stealth[length=5mm,width=3.2mm,bend]-] (0,0) to[out=45,in=150] ++ (1.5,0) to[out=-30,in=-135] ++ (3,0);
                endtikzpicture

                begintikzpicture[line width=1pt]
                pen (-135:.125) -- (45:.125) ;
                draw[calligraph,Stealth[length=5mm,width=3.2mm,bend]-] (0,0) to[out=45,in=150]
                ++ (1.5,0) to[out=-30,in=45] ++ (1,-2);
                endtikzpicture
                enddocument


                enter image description here






                share|improve this answer















                Here is a slight extension of Milo's nice answer. The main differences (improvements?) are:



                1. I rewrote Alain Matthes' nice answer to allow for arbitrary functions determining the line width. Previously it was a linearly dependence, now it can be an arbitrary function such as a sine. All you need to do is to say declare function=varyinglw(x)=1+6*sin(1.8*x);. Apart from that, I made the code a bit more general, increased its speed (I think) and got rid of makeatletter since there was nothing that cannot be achieved with commands not containing @s.

                2. This variation also does not nest tikzpictures. Rather, the arrows a re attached in the usual way, and can be even bent.

                Here's how this works



                • You need to find a function that determines how thick the line is at a given position of the path. This function has the name varyinglw. It's argument runs from 0 to 100. So if the function has a maximum at 50, the path will have reached its maximal width in the middle. An example for a function with this feature is declare function=varyinglw(x)=1+6*sin(1.8*x); below. If you want to use different functions, use scopes. Unfortunately I do not now how one can reset functions that are declared with declare functions. Therefore you should keep your functions local.

                • If you have a very long path, you may want to increase the number of segments since otherwise it won't look smooth any more. This can be done by saying e.g. /pgf/decoration/varying line width steps=180 as in the examples below.

                • Other than that you can use pretty much any path.



                documentclass[tikz,border=3.14mm]standalone
                usetikzlibrarydecorations,arrows.meta,bending
                begindocument

                pgfkeys/pgf/decoration/.cd,
                start color/.store in=startcolor,
                start color=black,
                end color/.store in=endcolor,
                end color=black,
                varying line width steps/.initial=100

                pgfdeclaredecorationwidth and color changeinitial
                stateinitial[width=0pt, next state=line, persistent precomputation=%
                pgfmathparsepgfdecoratedpathlength/pgfkeysvalueof/pgf/decoration/varying line width steps%
                letincrement=pgfmathresult%
                defx0%
                ]
                stateline[width=increment pt, persistent postcomputation=%
                pgfmathsetmacroxx+increment
                ,next state=line]%
                pgfmathparseifthenelse(x<pgfdecoratedpathlength-5mm,varyinglw(100*(x/pgfdecoratedpathlength)),
                varyinglw(100*((pgfdecoratedpathlength-5mm)/pgfdecoratedpathlength))*(pgfdecoratedpathlength-x)/14) )
                pgfsetlinewidthpgfmathresult pt%
                pgfpathmovetopgfpointorigin%
                pgfmathsetmacrosteplength1.4*increment
                pgfpathlinetopgfqpointsteplength pt0pt%
                pgfmathsetmacroy100*(x/pgfdecoratedpathlength)
                pgfsetstrokecolorendcolor!y!startcolor%
                pgfusepathstroke%

                statefinal%
                pgfsetlinewidthpgflinewidth%
                pgfpathmovetopgfpointorigin%
                pgfmathsetmacroy100*(x/pgfdecoratedpathlength)
                colorendcolor!y!startcolor%
                pgfusepathstroke%




                begintikzpicture[varying arrow/.style=-Stealth[length=5mm,width=3.2mm,bend],color=endcolor,
                postaction=/utils/exec=pgfsetarrows-,decorate,decoration=width and color change
                ]
                beginscope[declare function=varyinglw(x)=1+6*sin(1.8*x);]
                draw[varying arrow] (0,0) to[out=45,in=150] ++ (1.5,0) to[out=-30,in=-135] ++ (3,0);
                draw[varying arrow,/pgf/decoration/varying line width steps=180]
                (0,-3) to[out=45,in=150] ++ (1.5,0) to[out=-30,in=-135] ++ (3,0)
                to[out=45,in=45] ++ (-2,1);
                draw[varying arrow,/pgf/decoration/varying line width steps=180,
                /pgf/decoration/start color=red,/pgf/decoration/end color=blue]
                (0,-5) to[out=15,in=165] ++ (2,0) to[out=-15,in=90] ++ (1,-1)
                to[out=-90,in=-20] ++ (-1.5,0);
                endscope

                beginscope[declare function=varyinglw(x)=4-3*cos(7.2*x);,xshift=6cm]
                draw[varying arrow] (0,0) to[out=45,in=150] ++ (1.5,0) to[out=-30,in=-135] ++ (3,0);
                draw[varying arrow,/pgf/decoration/varying line width steps=180]
                (0,-3) to[out=45,in=150] ++ (1.5,0) to[out=-30,in=-135] ++ (3,0)
                to[out=45,in=45] ++ (-2,1);
                draw[varying arrow,/pgf/decoration/varying line width steps=180,
                /pgf/decoration/start color=yellow,/pgf/decoration/end color=red]
                (0,-5) to[out=15,in=165] ++ (2,0) to[out=-15,in=90] ++ (1,-1)
                to[out=-90,in=-20] ++ (-1.5,0);
                endscope

                beginscope[declare function=varyinglw(x)=4-3*cos(5.6*x);,xshift=12cm]
                draw[varying arrow] (0,0) to[out=45,in=150] ++ (1.5,0) to[out=-30,in=-135] ++ (3,0);
                draw[varying arrow,/pgf/decoration/varying line width steps=180]
                (0,-3) to[out=45,in=150] ++ (1.5,0) to[out=-30,in=-135] ++ (3,0)
                to[out=45,in=45] ++ (-2,1);
                draw[varying arrow,/pgf/decoration/varying line width steps=180,
                /pgf/decoration/start color=yellow,/pgf/decoration/end color=blue]
                (0,-5) to[out=15,in=165] ++ (2,0) to[out=-15,in=90] ++ (1,-1)
                to[out=-90,in=-20] ++ (-1.5,0);
                endscope
                endtikzpicture
                enddocument


                enter image description here



                FUN: The mandatory animation.



                documentclass[tikz,border=3.14mm]standalone
                usetikzlibrarydecorations,arrows.meta,bending
                begindocument

                pgfkeys/pgf/decoration/.cd,
                start color/.store in=startcolor,
                start color=black,
                end color/.store in=endcolor,
                end color=black,
                varying line width steps/.initial=100

                pgfdeclaredecorationwidth and color changeinitial
                stateinitial[width=0pt, next state=line, persistent precomputation=%
                pgfmathparsepgfdecoratedpathlength/pgfkeysvalueof/pgf/decoration/varying line width steps%
                letincrement=pgfmathresult%
                defx0%
                ]
                stateline[width=increment pt, persistent postcomputation=%
                pgfmathsetmacroxx+increment
                ,next state=line]%
                pgfmathparseifthenelse(x<pgfdecoratedpathlength-5mm,varyinglw(100*(x/pgfdecoratedpathlength)),
                varyinglw(100*((pgfdecoratedpathlength-5mm)/pgfdecoratedpathlength))*(pgfdecoratedpathlength-x)/14) )
                pgfsetlinewidthpgfmathresult pt%
                pgfpathmovetopgfpointorigin%
                pgfmathsetmacrosteplength1.4*increment
                pgfpathlinetopgfqpointsteplength pt0pt%
                pgfmathsetmacroy100*(x/pgfdecoratedpathlength)
                pgfsetstrokecolorendcolor!y!startcolor%
                pgfusepathstroke%

                statefinal%
                pgfsetlinewidthpgflinewidth%
                pgfpathmovetopgfpointorigin%
                pgfmathsetmacroy100*(x/pgfdecoratedpathlength)
                colorendcolor!y!startcolor%
                pgfusepathstroke%



                foreach Z in 0,10,...,720
                begintikzpicture[varying arrow/.style=-Stealth[length=5mm,width=3.2mm,bend],color=endcolor,
                postaction=/utils/exec=pgfsetarrows-,decorate,decoration=width and color change
                ]
                path[use as bounding box] (-4,-4) rectangle (4,4);
                beginscope[declare function=varyinglw(x)=1+6*sin(1.8*x);]
                draw[varying arrow] plot[variable=z,domain=Z+90:Z+180]
                (z:1+sqrt(z/90));
                endscope

                endtikzpicture
                enddocument


                enter image description here



                ALTERNATIVE: Some additional possibilities arise with the calligraphy library. (If I understand correctly, currently you need to download the latest version from this repository.)



                documentclass[tikz,border=3.14mm]standalone
                usepackagespath3
                usetikzlibrarycalligraphy % need to download the repository from https://github.com/loopspace/spath3
                % run "tex spath3.dtx" and then copy the spath3.sty file in the same directory
                % as the tex file
                usetikzlibraryarrows.meta,bending,decorations.pathreplacing
                tikzsetcalligraph/.style=postaction=decorate,decoration=show path construction,
                moveto code=,
                lineto code=,
                curveto code=
                calligraphy (tikzinputsegmentfirst) .. controls
                (tikzinputsegmentsupporta) and (tikzinputsegmentsupportb)
                ..(tikzinputsegmentlast);
                ,
                closepath code=

                begindocument
                begintikzpicture[line width=1pt]
                pen (-135:.125) -- (45:.125) ;
                draw[calligraph,Stealth[length=5mm,width=3.2mm,bend]-] (0,0) to[out=45,in=150] ++ (1.5,0) to[out=-30,in=-135] ++ (3,0);
                endtikzpicture

                begintikzpicture[line width=1pt]
                pen (-135:.125) -- (45:.125) ;
                draw[calligraph,Stealth[length=5mm,width=3.2mm,bend]-] (0,0) to[out=45,in=150]
                ++ (1.5,0) to[out=-30,in=45] ++ (1,-2);
                endtikzpicture
                enddocument


                enter image description here







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Jan 22 at 18:51

























                answered Jan 22 at 0:09









                marmotmarmot

                98.4k4113218




                98.4k4113218





















                    16














                    This isn't a complete answer. But as a proof of concept, I tried adapting this answer from Stroke with variable thickness to make something like the arrows you want.



                    enter image description here



                    documentclass[tikz,margin=0.5cm]standalone
                    usetikzlibrarydecorations,arrows.meta

                    makeatletter
                    pgfkeys/pgf/decoration/.cd,
                    start color/.store in =startcolor,
                    end color/.store in =endcolor

                    pgfdeclaredecorationwidth and color changeinitial
                    stateinitial[width=2pt, next state=line, persistent precomputation=%
                    pgfmathdivide50pgfdecoratedpathlength%
                    letincrement=pgfmathresult%
                    defx0%
                    ]
                    stateline[width=.5pt, persistent postcomputation=%
                    pgfmathadd@xincrement%
                    letx=pgfmathresult%
                    ]%
                    pgfsetlinewidthx/20*0.005pt+pgflinewidth%
                    pgfsetarrows-%
                    pgfpathmovetopgfpointorigin%
                    pgfpathlinetopgfqpoint.75pt0pt%
                    pgfsetstrokecolorendcolor!x!startcolor%
                    pgfusepathstroke%

                    statefinal%
                    pgfsetlinewidthpgflinewidth%
                    pgfpathmovetopgfpointorigin%
                    colorendcolor!x!startcolor%
                    pgfusepathstroke%


                    makeatother

                    begindocument

                    begintikzpicture

                    draw [line width=2pt, decoration=width and color change,start color=black, end color=black, decorate,] plot [smooth, tension=1] coordinates (0,0) (2,0.5) (5,0.7) (3,1.5) (1,1.5) node [rotate=100] tikz draw [-Stealth[length=7mm, width=10mm]](0,0); ;

                    endtikzpicture

                    enddocument





                    share|improve this answer


















                    • 4





                      @marmot I'm actually thinking about forbidding nesting in a future version of PGF. It's just not fixable and always calls for trouble.

                      – Henri Menke
                      Jan 22 at 1:26
















                    16














                    This isn't a complete answer. But as a proof of concept, I tried adapting this answer from Stroke with variable thickness to make something like the arrows you want.



                    enter image description here



                    documentclass[tikz,margin=0.5cm]standalone
                    usetikzlibrarydecorations,arrows.meta

                    makeatletter
                    pgfkeys/pgf/decoration/.cd,
                    start color/.store in =startcolor,
                    end color/.store in =endcolor

                    pgfdeclaredecorationwidth and color changeinitial
                    stateinitial[width=2pt, next state=line, persistent precomputation=%
                    pgfmathdivide50pgfdecoratedpathlength%
                    letincrement=pgfmathresult%
                    defx0%
                    ]
                    stateline[width=.5pt, persistent postcomputation=%
                    pgfmathadd@xincrement%
                    letx=pgfmathresult%
                    ]%
                    pgfsetlinewidthx/20*0.005pt+pgflinewidth%
                    pgfsetarrows-%
                    pgfpathmovetopgfpointorigin%
                    pgfpathlinetopgfqpoint.75pt0pt%
                    pgfsetstrokecolorendcolor!x!startcolor%
                    pgfusepathstroke%

                    statefinal%
                    pgfsetlinewidthpgflinewidth%
                    pgfpathmovetopgfpointorigin%
                    colorendcolor!x!startcolor%
                    pgfusepathstroke%


                    makeatother

                    begindocument

                    begintikzpicture

                    draw [line width=2pt, decoration=width and color change,start color=black, end color=black, decorate,] plot [smooth, tension=1] coordinates (0,0) (2,0.5) (5,0.7) (3,1.5) (1,1.5) node [rotate=100] tikz draw [-Stealth[length=7mm, width=10mm]](0,0); ;

                    endtikzpicture

                    enddocument





                    share|improve this answer


















                    • 4





                      @marmot I'm actually thinking about forbidding nesting in a future version of PGF. It's just not fixable and always calls for trouble.

                      – Henri Menke
                      Jan 22 at 1:26














                    16












                    16








                    16







                    This isn't a complete answer. But as a proof of concept, I tried adapting this answer from Stroke with variable thickness to make something like the arrows you want.



                    enter image description here



                    documentclass[tikz,margin=0.5cm]standalone
                    usetikzlibrarydecorations,arrows.meta

                    makeatletter
                    pgfkeys/pgf/decoration/.cd,
                    start color/.store in =startcolor,
                    end color/.store in =endcolor

                    pgfdeclaredecorationwidth and color changeinitial
                    stateinitial[width=2pt, next state=line, persistent precomputation=%
                    pgfmathdivide50pgfdecoratedpathlength%
                    letincrement=pgfmathresult%
                    defx0%
                    ]
                    stateline[width=.5pt, persistent postcomputation=%
                    pgfmathadd@xincrement%
                    letx=pgfmathresult%
                    ]%
                    pgfsetlinewidthx/20*0.005pt+pgflinewidth%
                    pgfsetarrows-%
                    pgfpathmovetopgfpointorigin%
                    pgfpathlinetopgfqpoint.75pt0pt%
                    pgfsetstrokecolorendcolor!x!startcolor%
                    pgfusepathstroke%

                    statefinal%
                    pgfsetlinewidthpgflinewidth%
                    pgfpathmovetopgfpointorigin%
                    colorendcolor!x!startcolor%
                    pgfusepathstroke%


                    makeatother

                    begindocument

                    begintikzpicture

                    draw [line width=2pt, decoration=width and color change,start color=black, end color=black, decorate,] plot [smooth, tension=1] coordinates (0,0) (2,0.5) (5,0.7) (3,1.5) (1,1.5) node [rotate=100] tikz draw [-Stealth[length=7mm, width=10mm]](0,0); ;

                    endtikzpicture

                    enddocument





                    share|improve this answer













                    This isn't a complete answer. But as a proof of concept, I tried adapting this answer from Stroke with variable thickness to make something like the arrows you want.



                    enter image description here



                    documentclass[tikz,margin=0.5cm]standalone
                    usetikzlibrarydecorations,arrows.meta

                    makeatletter
                    pgfkeys/pgf/decoration/.cd,
                    start color/.store in =startcolor,
                    end color/.store in =endcolor

                    pgfdeclaredecorationwidth and color changeinitial
                    stateinitial[width=2pt, next state=line, persistent precomputation=%
                    pgfmathdivide50pgfdecoratedpathlength%
                    letincrement=pgfmathresult%
                    defx0%
                    ]
                    stateline[width=.5pt, persistent postcomputation=%
                    pgfmathadd@xincrement%
                    letx=pgfmathresult%
                    ]%
                    pgfsetlinewidthx/20*0.005pt+pgflinewidth%
                    pgfsetarrows-%
                    pgfpathmovetopgfpointorigin%
                    pgfpathlinetopgfqpoint.75pt0pt%
                    pgfsetstrokecolorendcolor!x!startcolor%
                    pgfusepathstroke%

                    statefinal%
                    pgfsetlinewidthpgflinewidth%
                    pgfpathmovetopgfpointorigin%
                    colorendcolor!x!startcolor%
                    pgfusepathstroke%


                    makeatother

                    begindocument

                    begintikzpicture

                    draw [line width=2pt, decoration=width and color change,start color=black, end color=black, decorate,] plot [smooth, tension=1] coordinates (0,0) (2,0.5) (5,0.7) (3,1.5) (1,1.5) node [rotate=100] tikz draw [-Stealth[length=7mm, width=10mm]](0,0); ;

                    endtikzpicture

                    enddocument






                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Jan 21 at 22:13









                    MiloMilo

                    6,36721650




                    6,36721650







                    • 4





                      @marmot I'm actually thinking about forbidding nesting in a future version of PGF. It's just not fixable and always calls for trouble.

                      – Henri Menke
                      Jan 22 at 1:26













                    • 4





                      @marmot I'm actually thinking about forbidding nesting in a future version of PGF. It's just not fixable and always calls for trouble.

                      – Henri Menke
                      Jan 22 at 1:26








                    4




                    4





                    @marmot I'm actually thinking about forbidding nesting in a future version of PGF. It's just not fixable and always calls for trouble.

                    – Henri Menke
                    Jan 22 at 1:26






                    @marmot I'm actually thinking about forbidding nesting in a future version of PGF. It's just not fixable and always calls for trouble.

                    – Henri Menke
                    Jan 22 at 1:26


















                    draft saved

                    draft discarded
















































                    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%2f471204%2frandomly-curved-arrows-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

                    How to check contact read email or not when send email to Individual?

                    Displaying single band from multi-band raster using QGIS

                    How many registers does an x86_64 CPU actually have?