1

In the following figure:

\documentclass[margin=2mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usetikzlibrary{calc}
\usetikzlibrary{shapes.arrows}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{shadings}

%%%%%%%%%%%%%%%%%%

\begin{document}

%
\begin{tikzpicture} 
    \tikzset{
        line/.style = {draw},
        box/.style={arrow box, fill=#1},
    }
    \node[coordinate] (a) at (-10,-13) {};
    \node[coordinate] (b) at (-10,5) {};
    \node[coordinate] (c) at (9, 5) {};
    \node[coordinate] (d) at (9, -13) {};
    \draw[brown, line width=2pt, rotate=0, ] (a.center) -- (b.center) -- (c.center) -- (d.center) -- cycle;

    \draw[color= blue!30, line width=1pt, fill=blue!30] plot[domain=0:350, smooth cycle] (\x:2+rnd*0.5 and 3+rnd*0.5) node[] (cloud_A){};
    \node[color=black] at (3,0) (A){\Huge{A}}; 
    \draw[color= green!30, line width=1pt, fill=green!30, yshift=-8cm] plot[domain=0:350, smooth cycle] (\x:2+rnd*0.5 and 3+rnd*0.5) node[] (cloud_C){};
    \node[ color=black] at (3,-8) (B){\Huge{B}}; 
    \draw[color= red!30, line width=0pt, fill=red!30, yshift=-4cm, fill opacity=0.5] plot[domain=0:350, smooth cycle] (\x:2+rnd*0.5 and 3+rnd*0.5) node[] (cloud_B){};
    \node[color=black] at (3,-4) (C){\Huge{C}};
    \node (m) [] at ($(a)!0.5!(b)$) {};
    \node[rectangle, draw=black, fill=red!70!blue!70, text=white, left of=m, minimum height=1cm,minimum width=3cm] (R) [rotate=90]{\huge{Reader}};
    \node[circle,draw=black, thick] at ($(b)+(1,-1)$) (ANT1){\Huge{$1$}};
    \node[circle,draw=black, thick] at ($(a)+(1,1)$) (ANT2){\Huge{$2$}};
    \path [line,  line width=0.75mm] (R) |- (ANT1);
    \path [line, line width=0.75mm] (R) |- (ANT2);
    \node[rectangle, draw=black, fill=gray, minimum height=0.5cm,minimum width=2.5cm, rotate=45] at ($(ANT1)+(1,-1)$)  (PATCH1){};
    \node[rectangle, draw=black, fill=gray, minimum height=0.5cm,minimum width=2.5cm, rotate=-45] at ($(ANT2)+(1,1)$)  (PATCH2){};

    \node[minimum size=2cm, box=blue!50!green, arrow box arrows={west:3cm}, text=white] at (12,-4) (BATCH){\huge{Batch}};

    \node[] at ($(BATCH) + (0,-1.5)$) (TAG){\LARGE{N}};

    \node [minimum height=4.75cm, double arrow head extend=.4cm, fill=red!60, double arrow, draw=none, rotate=-45] at ($(PATCH1)+(3,-1.7)$) (ArrowP1){\huge{Policy $\alpha$}};
    \node [minimum height=4.75cm, double arrow head extend=.4cm, fill=blue!75, double arrow, draw=none, rotate=45, text=white] at ($(PATCH2)+(3,1.7)$) (ArrowP2){\huge{Policy $\beta$}};
    \node [minimum height=4.75cm, double arrow head extend=.4cm, fill=yellow!50, double arrow, draw=none, rotate=-45, ] at ($(ArrowP1)+(-1.25,-1.25)$) (ArrowP3a){\huge{Policy $\gamma$ ($50\%$)}};

    \node [minimum height=4.75cm, double arrow head extend=.4cm, fill=yellow!50, double arrow, draw=none, rotate=45, ] at ($(ArrowP2)+(-1.25,1.25)$) (ArrowP3b){\huge{Policy $\gamma$ ($50\%$)}};

    \node[coordinate] (disp) at (8,-4) {};
    \path[>={Triangle[width=3.6mm,length=2.mm]},->,line width=1.0mm, color=blue!50!green] (disp) edge [out=180, in=0] (A);
    \path[>={Triangle[width=3.6mm,length=2.mm]},->,line width=1.0mm, color=blue!50!green] (disp) edge [out=180, in=0] (C);
    \path[>={Triangle[width=3.6mm,length=2.mm]},->,line width=1.0mm, color=blue!50!green] (disp) edge [out=180, in=0] (B);
\end{tikzpicture}

\end{document}

enter image description here

I would like to vary the colors of some of the point lines of the double arrow in yellow like this.

enter image description here

with the left and right lines of the arrow have different colours.

In the pgfmanual the double arrow anchor is named (Page.813):

enter image description here

I would like to change the color of the lines between s.before tip 2 and s.after tip 2` for example, and, the same with the other side of the arrow, tip 1.

1
  • 1
    You can't change color only a part of border. This you can do by overdrawing desired part of double arrow shape with draw[<selected color> (s.after tip 2) -- (s.tip2) -- (s.before tip2);
    – Zarko
    May 19, 2020 at 12:21

1 Answer 1

1

You can add these colored lines to the definition of the respective arrow. This works with the append after command key as in

    double colored arrow/.style 2 args={double arrow,
    append after command={
    (\tikzlastnode.tip 1) edge[#1,line cap=rect] (\tikzlastnode.before tip 1)
    (\tikzlastnode.tip 1) edge[#1,line cap=rect] (\tikzlastnode.after tip 1)
    (\tikzlastnode.tip 2) edge[#2,line cap=rect] (\tikzlastnode.before tip 2)
    (\tikzlastnode.tip 2) edge[#2,line cap=rect] (\tikzlastnode.after tip 2)
    }}

Here is how one can then use the style.

\documentclass[margin=2mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usetikzlibrary{calc}
\usetikzlibrary{shapes.arrows}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{shadings}

%%%%%%%%%%%%%%%%%%

\begin{document}

%
\begin{tikzpicture} 
    \tikzset{
        line/.style = {draw},
        box/.style={arrow box, fill=#1},
        double colored arrow/.style 2 args={double arrow,
        append after command={
        (\tikzlastnode.tip 1) edge[#1,line cap=rect] (\tikzlastnode.before tip 1)
        (\tikzlastnode.tip 1) edge[#1,line cap=rect] (\tikzlastnode.after tip 1)
        (\tikzlastnode.tip 2) edge[#2,line cap=rect] (\tikzlastnode.before tip 2)
        (\tikzlastnode.tip 2) edge[#2,line cap=rect] (\tikzlastnode.after tip 2)
        }}
    }
    \node[coordinate] (a) at (-10,-13) {};
    \node[coordinate] (b) at (-10,5) {};
    \node[coordinate] (c) at (9, 5) {};
    \node[coordinate] (d) at (9, -13) {};
    \draw[brown, line width=2pt, rotate=0, ] (a.center) -- (b.center) -- (c.center) -- (d.center) -- cycle;

    \draw[color= blue!30, line width=1pt, fill=blue!30] plot[domain=0:350, smooth cycle] (\x:2+rnd*0.5 and 3+rnd*0.5) node[] (cloud_A){};
    \node[color=black] at (3,0) (A){\Huge{A}}; 
    \draw[color= green!30, line width=1pt, fill=green!30, yshift=-8cm] plot[domain=0:350, smooth cycle] (\x:2+rnd*0.5 and 3+rnd*0.5) node[] (cloud_C){};
    \node[ color=black] at (3,-8) (B){\Huge{B}}; 
    \draw[color= red!30, line width=0pt, fill=red!30, yshift=-4cm, fill opacity=0.5] plot[domain=0:350, smooth cycle] (\x:2+rnd*0.5 and 3+rnd*0.5) node[] (cloud_B){};
    \node[color=black] at (3,-4) (C){\Huge{C}};
    \node (m) [] at ($(a)!0.5!(b)$) {};
    \node[rectangle, draw=black, fill=red!70!blue!70, text=white, left of=m, minimum height=1cm,minimum width=3cm] (R) [rotate=90]{\huge{Reader}};
    \node[circle,draw=black, thick] at ($(b)+(1,-1)$) (ANT1){\Huge{$1$}};
    \node[circle,draw=black, thick] at ($(a)+(1,1)$) (ANT2){\Huge{$2$}};
    \path [line,  line width=0.75mm] (R) |- (ANT1);
    \path [line, line width=0.75mm] (R) |- (ANT2);
    \node[rectangle, draw=black, fill=gray, minimum height=0.5cm,minimum width=2.5cm, rotate=45] at ($(ANT1)+(1,-1)$)  (PATCH1){};
    \node[rectangle, draw=black, fill=gray, minimum height=0.5cm,minimum width=2.5cm, rotate=-45] at ($(ANT2)+(1,1)$)  (PATCH2){};

    \node[minimum size=2cm, box=blue!50!green, arrow box arrows={west:3cm}, text=white] at (12,-4) (BATCH){\huge{Batch}};

    \node[] at ($(BATCH) + (0,-1.5)$) (TAG){\LARGE{N}};

    \node [minimum height=4.75cm, double arrow head extend=.4cm, fill=red!60, double arrow, draw=none, rotate=-45] at ($(PATCH1)+(3,-1.7)$) (ArrowP1){\huge{Policy $\alpha$}};
    \node [minimum height=4.75cm, double arrow head extend=.4cm, fill=blue!75, double arrow, draw=none, rotate=45, text=white] at ($(PATCH2)+(3,1.7)$) (ArrowP2){\huge{Policy $\beta$}};
    \node [minimum height=4.75cm, double arrow head extend=.4cm, fill=yellow!50,
     double colored arrow={blue,thick}{red,thick}, draw=none, rotate=-45, ] at ($(ArrowP1)+(-1.25,-1.25)$) (ArrowP3a){\huge{Policy $\gamma$ ($50\%$)}};

    \node [minimum height=4.75cm, double arrow head extend=.4cm, 
    fill=yellow!50, double colored arrow={red,thick}{blue,thick}, draw=none, rotate=45] at ($(ArrowP2)+(-1.25,1.25)$) (ArrowP3b){\huge{Policy $\gamma$ ($50\%$)}};

    \node[coordinate] (disp) at (8,-4) {};
    \path[>={Triangle[width=3.6mm,length=2.mm]},->,line width=1.0mm, color=blue!50!green] (disp) edge [out=180, in=0] (A);
    \path[>={Triangle[width=3.6mm,length=2.mm]},->,line width=1.0mm, color=blue!50!green] (disp) edge [out=180, in=0] (C);
    \path[>={Triangle[width=3.6mm,length=2.mm]},->,line width=1.0mm, color=blue!50!green] (disp) edge [out=180, in=0] (B);
\end{tikzpicture}

\end{document}

enter image description here

Notice that you also can in principle use the node boundary path and partly color it with a dash pattern. In this case this is just not very convenient, but in principle it is possible.

You must log in to answer this question.

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