# Highlighting specific parts of a customize graph

I want to highlight specific parts, like this, for my graph (see code below). But in my case the highlighting (from the link above) doesn't work. The specific customized graph elements come from here.

\documentclass[border=5pt, xcolor=dvipsnames]{standalone}
\usepackage[dvipsnames]{xcolor}
\usepackage[utf8x]{inputenc}
\usepackage{tikz}\usetikzlibrary{positioning,backgrounds,calc,trees,decorations.markings,automata,angles,quotes}

\tikzset{
myneg/.style={
decoration={
markings,
mark=at position 0.5 with
{\draw (0,0) arc (0:180:#1) (0,0) arc (180:360:#1);}
},
postaction=decorate
},
myneg/.default=6pt,
mynode/.style={
draw,
circle,
minimum size=20pt
}
}

\pgfdeclarelayer{background}
\pgfsetlayers{background,main}

\newcommand{\convexpath}[2]{
[
create hullnodes/.code={
\global\edef\namelist{#1}
\foreach [count=\counter] \nodename in \namelist {
\global\edef\numberofnodes{\counter}
\node at (\nodename) [draw=none,name=hullnode\counter] {};
}
\node at (hullnode\numberofnodes) [name=hullnode0,draw=none] {};
\pgfmathtruncatemacro\lastnumber{\numberofnodes+1}
\node at (hullnode1) [name=hullnode\lastnumber,draw=none] {};
},
create hullnodes
]
($(hullnode1)!#2!-90:(hullnode0)$)
\foreach [
evaluate=\currentnode as \previousnode using \currentnode-1,
evaluate=\currentnode as \nextnode using \currentnode+1
] \currentnode in {1,...,\numberofnodes} {
-- ($(hullnode\currentnode)!#2!-90:(hullnode\previousnode)$)
let \p1 = ($(hullnode\currentnode)!#2!-90:(hullnode\previousnode) - (hullnode\currentnode)$),
\n1 = {atan2(\x1,\y1)},
\p2 = ($(hullnode\currentnode)!#2!90:(hullnode\nextnode) - (hullnode\currentnode)$),
\n2 = {atan2(\x2,\y2)},
\n{delta} = {-Mod(\n1-\n2,360)}
in
{arc [start angle=\n1, delta angle=\n{delta}, radius=#2]}
}
-- cycle
}

\begin{document}
\begin{tikzpicture}[node distance=1cm and 2cm]
\node[mynode, color=MidnightBlue] (b) at (0,0) {$U_3$};
\node[mynode,above=of b,color=MidnightBlue] (a) {$U_2$};
\node[mynode, above=of a,color=MidnightBlue] (h) {$U_1$};
\node[mynode,below=of b,color=MidnightBlue] (c) {$U_4$};
\node[mynode,right=of b] (d) {$$}; \node[mynode,right=of d,color=BrickRed] (e) {W_2}; \node[mynode,below=of e,color=BrickRed] (f) {W_3}; \node[mynode,above =of e, color=BrickRed] (j) {W_1}; \coordinate (aux) at (d.west); \foreach \Value in {a,b,c} \draw (\Value) -- (aux); \path pic[draw,angle radius=35pt,"\raisebox{20pt}{\lor}", angle eccentricity=1.25] {angle=a--aux--c}; \node[above left= -0.3 cm and 1 cm of j,font=\scshape] {\land}; \draw (h) -- (j); \draw[] (d) -- (e); \draw[myneg] (c) -- (f); \draw[myneg] (a) -- (j); \fill[red,opacity=0.3] \convexpath{h,a,j}{40pt}; \end{tikzpicture} \end{document}  Below there is the code just for the graph, in which I want to highlight specific parts:  \documentclass[border=5pt, xcolor=dvipsnames]{standalone} \usepackage[dvipsnames]{xcolor} \usepackage[utf8x]{inputenc} \usepackage{tikz} \usetikzlibrary{positioning,decorations.markings,automata,angles,quotes} \tikzset{ myneg/.style={ decoration={ markings, mark=at position 0.5 with {\draw (0,0) arc (0:180:#1) (0,0) arc (180:360:#1);} }, postaction=decorate }, myneg/.default=6pt, mynode/.style={ draw, circle, minimum size=20pt } } \begin{document} \begin{tikzpicture}[node distance=1cm and 2cm] \node[mynode, color=MidnightBlue] (b) at (0,0) {U_3}; \node[mynode,above=of b,color=MidnightBlue] (a) {U_2}; \node[mynode, above=of a,color=MidnightBlue] (h) {U_1}; \node[mynode,below=of b,color=MidnightBlue] (c) {U_4}; \node[mynode,right=of b] (d) {$$};
\node[mynode,right=0cm and 4.5cm of b,color=BrickRed] (e) {$W_2$};
\node[mynode,right= 0cm and 4.5cm of c,color=BrickRed] (f) {$W_3$};
\node[mynode,right =0cm and 4.5cm of a, color=BrickRed] (j) {$W_1$};
\coordinate (aux) at (d.west);
\foreach \Value in {a,b,c}
\draw (\Value) -- (aux);
\path
pic[draw,angle radius=35pt,"\raisebox{20pt}{$\lor$}",
angle eccentricity=1.25]
{angle=a--aux--c};

\node[above left= -0.3 cm and  1 cm  of j,font=\scshape] {$\land$};

\draw
(h) -- (j);

\draw[]
(d) -- (e);
\draw[myneg]
(c) -- (f);
\draw[myneg]
(a) -- (j);

\end{tikzpicture}

\end{document}

• "Won't work" is too vague. Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}. Nov 9 '15 at 14:24
• What are you actually trying to shade?
– cfr
Nov 11 '15 at 23:28
• The code you are using to shade is designed for a downwards-growing tree shape - not one growing west.
– cfr
Nov 11 '15 at 23:38
• Is there a way to change the code for growing west? Nov 13 '15 at 12:10
• As a simple, but perhaps not equally pretty, solution, you could try just drawing a very wide line from node to node, as in drawing oddly shaped nodes to contain existing nodes in tikz Nov 15 '15 at 0:25