[Tex/LaTex] Specific arrow tip style for specific path

tikz-pgf

\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}

Best Answer

You can replace the > with the desired type of arrow. Below I used the latex and stealth type of arrow in the first image. Alternatively, you can leave the > and apply \tikzset{>=latex} which will replace all > with a latex style arrow as in the second image:

enter image description here

Code:

\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}