# Creating vertical semi-transparent stripes over TikZ drawing

While writing my thesis, I am trying to show partial orderings with various areas of it grayed out. Ideally, for clarity of explanation, I would like to gray out some of the areas using vertical stripes, as:

I know how to construct the graph/poset image, but not the striped areas. Can someone point me in the right direction?

Edit. Thanks to the suggestions, I was able to make the following:

    \documentclass[tikz]{standalone}
\usepackage{tikz}
\usetikzlibrary{patterns, arrows}
\pgfdeclarepatternformonly{super ultra thick north east lines}{\pgfqpoint{-2pt}{-2pt}}{\pgfqpoint{10pt}{10pt}}{\pgfqpoint{10pt}{10pt}}%
{
\pgfsetlinewidth{2pt}
\pgfpathmoveto{\pgfqpoint{-1pt}{-1pt}}
\pgfpathlineto{\pgfqpoint{9pt}{9pt}}
\pgfusepath{stroke}
}
\begin{document}
\tikzset{
pon/.style = {circle,align=center, black, draw=black, text width=3.0em, thick},
}
\begin{tikzpicture}[->,level/.style={sibling distance = 2.5cm/#1, level distance = 1.5cm}, style={very thick}]
\node (max)  [pon] at (0,4) {$c_1, c_2, c_3\$};
\node (c1c2) [pon] at (-2, 2) {$c_1, c_2$};
\node (c1c3) [pon] at (0, 2) {$c_1, c_3$};
\node (c2c3) [pon] at (2, 2) {$c_2, c_3$};
\node (c1) [pon] at (-2, 0) {$c_1$};
\node (c2) [pon] at (0, 0) {$c_2$};
\node (c3) [pon] at (2, 0) {$c_3$};
\draw (max) -- (c1c2);
\draw (max) -- (c1c3);
\draw (max) -- (c2c3);
\draw (c1c2) -- (c1);
\draw (c1c2) -- (c2);
\draw (c1c3) -- (c1);
\draw (c1c3) -- (c3);
\draw (c2c3) -- (c2);
\draw (c2c3) -- (c3);
% top row shading
\path (-2.75,4.75) rectangle (3,3) [path picture={
\foreach \xShift in {-50,-40,...,160}
\draw[line width=2pt, opacity=.5, shorten <=-2\pgflinewidth] ([xshift=\xShift pt] path picture bounding box.south west)
-- ++ (100pt,100pt);
}];
% bottom
\path (-2.75,-1) rectangle (3,1) [path picture={
\foreach \xShift in {-50,-40,...,160}
\draw[line width=2pt, opacity=.5, shorten <=-2\pgflinewidth] ([xshift=\xShift pt] path picture bounding box.south west)
-- ++ (100pt,100pt);
}];
\end{tikzpicture}
\end{document}

-
Welcome to TeX-SX! Have a look at our starter page for a quick intro if you wish to familiarize yourself with our format. Note that you don't have to sign with your name since it automatically appears in the lower right corner of your post. – Claudio Fiandrino Jul 30 '13 at 13:53
It would help if you could provide a minimal working example (MWE) so we could work on the already existing diagram. Either way, check the manual for patterns and the library with the same name. Though you might need to create your own thick north east lines pattern (or draw it manually, e.g. with a path picture and a \foreach loop, which is not that fast but a little easier to do). – Qrrbrbirlbel Jul 30 '13 at 14:03

The first example uses the already defined pattern north east lines which uses the default line width of .4pt (thin) and has a fixed spacing between the lines.

The second example uses a similar defined super ultra thick north east lines with the line width2pt which also uses more spacing between the lines. Combined with the opacity this may give unedifying results as these lines are constructed out of many short lines. Depending on the viewer I have seen varying rendering.

The third example uses a path picture that works similar like a filling as it is clipped against the path itself. You also have more control over the lines as they can be positioned relative to the path. Depending on your path you might need to adjust the values if you have a higher or wider path.

## Code

\documentclass[tikz]{standalone}
\usetikzlibrary{patterns}
\pgfdeclarepatternformonly{super ultra thick north east lines}{\pgfqpoint{-2pt}{-2pt}}{\pgfqpoint{10pt}{10pt}}{\pgfqpoint{10pt}{10pt}}%
{
\pgfsetlinewidth{2pt}
\pgfpathmoveto{\pgfqpoint{-1pt}{-1pt}}
\pgfpathlineto{\pgfqpoint{9pt}{9pt}}
\pgfusepath{stroke}
}
\begin{document}
\tikz\pattern[opacity=.5, pattern=north east lines] (0,0) rectangle (3,2);
\tikz\pattern[opacity=.5, pattern=super ultra thick north east lines] (0,0) rectangle (3,2);
\tikz
\path (0,0) rectangle (3,2) [path picture={
\foreach \xShift in {-50,-40,...,100}
\draw[line width=2pt, opacity=.5, shorten <=-2\pgflinewidth] ([xshift=\xShift pt] path picture bounding box.south west)
-- ++ (100pt,100pt);
}];
\end{document}

-
This was extremely helpful, thank you. Do you know why the vertical lines do not complete the rectangle -- and leave a lower right triangle of whitespace in my code? – trope Jul 30 '13 at 15:40
@trope Yes, your rectangle is wider than the one I used in my example. Set the end of the \foreach loop to 160. It would be better to make the loop dependent on the size of the path picture (maybe I’ll update my answer later today). Do the actual pattern do not satisfy you? – Qrrbrbirlbel Jul 30 '13 at 15:44
No, they're perfect! Setting it to 160 did the trick. Thanks for your help! – trope Jul 30 '13 at 15:48