特定路径的特定箭头尖样式

特定路径的特定箭头尖样式
\documentclass[12pt]{article}
\usepackage{tikz}
\usetikzlibrary{decorations.markings}

\begin{document}

\begin{tikzpicture}[scale=1.5,cap ,color= blue] 

% grid
\draw[very thin,color = green,step = 0.5 cm, opacity= 0.9](0,0) grid (4, 4);

% axis 
\draw[->]  [blue,  thick] ( 0,0) --( 4,0) node[right] {$x$};
\draw[->]  [blue,  thick] ( 0,0) --( 0,4) node[above] {$y$};
% how to change the arrow tip style at specific path
% how to set up unique arrow head as a decoration at (1,0) coordinate and at (0,1) 
\draw[decoration={markings, mark=at position 0.5 with {\arrow [ ultra thick] {>}}},
       postaction={decorate}]
        (0,0)--( 2,0);
\draw[decoration={markings, mark=at position 0.5 with {\arrow [ ultra thick] {>}}},
       postaction={decorate}]
        (0,0)--( 0,2);
\end{tikzpicture}
\end{document}

答案1

您可以>用所需的箭头类型替换。下面我在第一张图片中使用了latex和箭头类型。或者,您可以保留并应用,这将用样式箭头替换所有内容,如第二张图片所示:stealth>\tikzset{>=latex}>latex

在此处输入图片描述

代码:

\documentclass[12pt]{article}
\usepackage{tikz}
\usetikzlibrary{decorations.markings}
\tikzset{>=latex} 

\begin{document}

\begin{tikzpicture}[scale=1.5,cap=0.5 ,color= blue] 

% grid
\draw[very thin,color = green,step = 0.5 cm, opacity= 0.9](0,0) grid (4, 4);

% axis 
\draw[->]  [blue,  thick] ( 0,0) --( 4,0) node[right] {$x$};
\draw[->]  [blue,  thick] ( 0,0) --( 0,4) node[above] {$y$};
% how to change the arrow tip style at specific path
% how to set up unique arrow head as a decoration at (1,0) coordinate and at (0,1) 
\draw[decoration={markings, mark=at position 0.5 with {\arrow [ ultra thick] {latex}}},
       postaction={decorate}]
        (0,0)--( 2,0);
\draw[decoration={markings, mark=at position 0.5 with {\arrow [ ultra thick] {stealth}}},
       postaction={decorate}]
        (0,0)--( 0,2);
\end{tikzpicture}
%
\begin{tikzpicture}[scale=1.5,cap=0.5 ,color= blue] 

% grid
\draw[very thin,color = green,step = 0.5 cm, opacity= 0.9](0,0) grid (4, 4);

% axis 
\draw[->]  [blue,  thick] ( 0,0) --( 4,0) node[right] {$x$};
\draw[->]  [blue,  thick] ( 0,0) --( 0,4) node[above] {$y$};
% how to change the arrow tip style at specific path
% how to set up unique arrow head as a decoration at (1,0) coordinate and at (0,1) 
\draw[decoration={markings, mark=at position 0.5 with {\arrow [ ultra thick] {>}}},
       postaction={decorate}]
        (0,0)--( 2,0);
\draw[decoration={markings, mark=at position 0.5 with {\arrow [ ultra thick] {>}}},
       postaction={decorate}]
        (0,0)--( 0,2);
\end{tikzpicture}
\end{document}

相关内容