I'm trying to use tikz to draw a line that changes color at two different points. As you can see from the code below, what I want is a line that starts solid red, changes to dotted gray, and ends as solid green. When I compile, though, I get the red section only, without the other two. What is the remedy?
\documentclass[border=2mm]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
%% The line itself
\draw [red, very thick, |-] (0,0) -- (22,0);
\draw [gray, very thick, dotted] (22,0 -- 26,0);
\draw [green, very thick, ->] (26,0 -- 40,0);
\end{tikzpicture}
\end{document}
(22,0) -- (26,0)instead of(22,0 -- 26,0), and(26,0) -- (40,0)instead of(26,0 -- 40,0). – jub0bs Jun 26 '14 at 20:30