TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm drawing a multi-segment line with TikZ as below:

    \draw[->] (0.25,0) --(0.75,1.2) -- (1.25,1.5) -- (1.75,0.7) -- (2.25,1.1) -- (2.75,0.5) -- (3.25,1.5) -- (4.25,1.8);

I'd like a few of the segments of the line to be thick, and the rest to be thin. Or, put another way, I'd like the line to be thick from (0.25,0) up until (1.75,0.7).

If I just do \draw[thick] ... the whole line becomes thick, which is not what I want.

Any thoughts?


share|improve this question
This isn't possible without splitting the path into segments, or doing something a little fancy. See tex.stackexchange.com/q/43309/86 for one way to do this. Is that close to what you want? – Loop Space Apr 11 '12 at 16:27
That looks pretty good, but I couldn't get it working, and it's unclear if you can mix to[] blocks with -- connections. – Richard Apr 11 '12 at 16:46
@AndrewStacey, I've commented on the answer you linked to above - the code there doesn't seem to be working. – Richard Apr 11 '12 at 16:49
There was a spurious blank line. I've removed it. – Loop Space Apr 11 '12 at 17:51
up vote 4 down vote accepted

The solution is somewhere on the site but about dashed line and solid line. I can't find this answer but I will delete my answer if someone gives the good link


xultra thick/.style={to path={%
 \draw[line cap=round, line join=round,ultra thick]
      (\tikztostart) -- (\tikztotarget);} (\tikztotarget) \tikztonodes}},
xthin/.style={to path={%
 \draw[line cap=round, line join=round,thin] 
       (\tikztostart) -- (\tikztotarget);} (\tikztotarget)  \tikztonodes}}} 
  \draw (0.25,0) -- (0.75,1.2) -- (1.25,1.5) 
  to[xultra thick]  (1.75,0.7) -- (2.25,1.1) -- (2.75,0.5)
                 -- (3.25,1.5) to[xthin] (4.25,1.8);

enter image description here

share|improve this answer
I think this is the original question and this is your nice elaboration. – percusse Apr 11 '12 at 17:15
No there is another answer with xdashed and xsolid styles. – Alain Matthes Apr 11 '12 at 17:31

In a very basic way you can break the segment into two subsegments:

\draw[thick] (0.25,0) --(0.75,1.2) -- (1.25,1.5) -- (1.75,0.7); 
\draw[->] (1.75,0.7) -- (2.25,1.1) -- (2.75,0.5) -- (3.25,1.5) -- (4.25,1.8);

Another solution that allows you to decide the thickness of the line is:

 \draw[line width=1pt] (0.25,0) --(0.75,1.2) -- (1.25,1.5) -- (1.75,0.7); 
 \draw[->,line width=0.5pt](1.75,0.7) -- (2.25,1.1) -- (2.75,0.5) -- (3.25,1.5) -- (4.25,1.8);
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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