I was looking for a way to fill the bars in bar plots or stacked bar plots with hashes or dots (something like the following figure).

enter image description here

Since it took me a long time to figure it out how to do it, I share my finding here as an answer, maybe it is useful for someone else.

  • 1
    Nice. You can answer your own question.
    – percusse
    Commented Apr 22, 2013 at 0:00
  • Do you mean I should remove the second part from question, and it as answer?
    – antmw1361
    Commented Apr 22, 2013 at 0:05

1 Answer 1


The key to solving the problem is using the pattern package which is introduced in the PGF manual.

\begin{axis}[ybar stacked]
\addplot [draw=blue,pattern=horizontal lines light blue] coordinates {(1,1)  (2,3) (3,2)};
\addplot [draw=red, pattern color = green, pattern = north west lines] coordinates {(1,1)  (2,1) (3,1)};
\addplot [pattern = dots] coordinates {(1,1)  (2,1) (3,1)};

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .