TransWikia.com

tikz: how to draw a fat arrow, specifying border and fill colour

TeX - LaTeX Asked by Viesturs on March 16, 2021

I am evolving on tikz: how to draw a fat arrow

I would like to specify the border and fill colour of the fat arrow.

I try:

documentclass{standalone}
usepackage{tikz}
usetikzlibrary{arrows.meta}
begin{document}
begin{tikzpicture}
  draw[blue, fill=green, -{Triangle[width = 18pt, length = 8pt]}, line width = 10pt] (0.0, 0.0) -- (1.0, 0.0);
end{tikzpicture}
end{document}

The result is an arrow in one colour:

enter image description here

What to add?

One Answer

As single arrow shape:

enter image description here

documentclass[border=3.141592]{standalone}
usepackage{tikz}
usetikzlibrary{shapes.arrows}

begin{document}
    begin{tikzpicture}
node[single arrow, draw=blue, fill=green, 
      minimum width = 10pt, single arrow head extend=3pt,
      minimum height=10mm] {}; % length of arrow
    end{tikzpicture}
end{document}

Addendum: drawing of arrows with shape is not so versatile as with simple line. For example it can't be bended, for change of its direction you need to rotate it:

documentclass[border=3.141592]{standalone}
usepackage{tikz}
usetikzlibrary{fit,
                shapes.arrows}

begin{document}
    begin{tikzpicture}
    begin{tikzpicture}
node[single arrow, draw=blue, very thick, fill=green,
      minimum width = 10pt, single arrow head extend=3pt,
      minimum height=10mm,
      rotate=45] {}; % length of arrow
    end{tikzpicture}
end{document}

enter image description here

Between to coordinates you can draw it with some precaution with help of fit library ...

documentclass[border=3.141592]{standalone}
usepackage{tikz}
usetikzlibrary{fit,
                shapes.arrows}

begin{document}
    begin{tikzpicture}
coordinate[pin=a] (a) at (0,0);
coordinate[pin=b] (b) at (1,0);
node[single arrow, draw=blue, very thick, fill=green,
      minimum width = 10pt, single arrow head extend=3pt,
      inner xsep=0pt,
      fit=(a) (b)] {}; % length of arrow
    end{tikzpicture}
end{document}

enter image description here

For more versatile arrows, you may consider to draw two arrows of different thickness: thinner over thicker:

documentclass[border=3.141592]{standalone}
usepackage{tikz}
usetikzlibrary{arrows.meta,
                bending}

begin{document}
    begin{tikzpicture}
path[draw=blue,   line width=2mm, -{Triangle[length=6mm, bend]}]    
        (0,0) to [bend left]    (2,2);
path[draw=green, line width=1mm, -{Triangle[length=4mm, bend]}, shorten >=1mm, shorten <=0.5mm]    
        (0,0) to [bend left]    (2,2);
    end{tikzpicture}
end{document}

Of course, in above MWE you need to do some fine adjustment of arrows head (now I didn't bother with this) that "border" of combined arrows has the same thickness everywhere.

enter image description here

Correct answer by Zarko on March 16, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP