我正在不断进步tikz:如何绘制粗箭头
我想指定粗箭头的边框和填充颜色。
我尝试:
\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}
结果是一支单色的箭头:
要添加什么?
答案1
形状single arrow
:
\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}
附录: 绘制带有形状的箭头并不像绘制简单的线条那样灵活。例如,它不能弯曲,要改变方向,您需要旋转它:
\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}
在坐标之间,您可以借助fit
库谨慎地绘制它......
\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}
为了使箭头更加灵活,你可以考虑绘制两个不同粗细的箭头:较细的箭头位于较粗的箭头之上:
\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}
当然,在上面的 MWE 中,您需要对箭头做一些精细的调整(现在我没有理会这个),以使组合箭头的“边框”在各处具有相同的厚度。