突出显示自定义图表的特定部分

突出显示自定义图表的特定部分

我想突出特定的部分,比如,用于我的图表(见下面的代码)。但在我的例子中,突出显示(来自上面的链接)不起作用。特定的自定义图表元素来自这里

\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}

在此处输入图片描述

下面是图表的代码,我想突出显示其中的特定部分:

    \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}

相关内容