7
\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}
  • 2
    Please reduce the title and add some explanations to the post, e.g. a sketch or screen shot of what you want to achieve. A tip: If you indent lines by 4 spaces or enclose words in backticks `, they'll be marked as code, as can be seen in my edit. You can also highlight the code and click the "code" button (with "{}" on it). – user31729 Aug 4 '14 at 7:17
7

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}
|improve this answer|||||
  • As a MWE this works. This is one of the include files. However, this is a book, so before \front matter, I have a list of usetikzlibrary. Now I had a code "\tikzset{>=latex} . This gives a standardised arrow throughout every tikzpicture drawn. It does not typeset into desired tip. Kindly advise what I don't understand or missed out. – mark Aug 4 '14 at 8:50
  • @mark: Have updated solution to show that using \tikzset{>=latex} does indeed work. IF that still does not work, please update your question with a MWE that reproduces the problem. – Peter Grill Aug 4 '14 at 16:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.