# Colored directed graph

I'm attempting to draw the following diagram in LaTeX, using Tikz: How could I go about achieving an image like this?

I'm puzzled to deal with the artificial "√"(tick) and "×"(cross).

By the way ,Which PDF introducing \foreach do you recommend?

Thanks for all of you!

Now,I'm capable of drawing the following figure.(But how to deal with the position of checkmark and other figures?)

As far as I am known, we should use foreach to draw other figures.

Code:

\documentclass[border={10}]{standalone}
\usepackage{tikz}
\usepackage{amssymb}
\usepackage{pifont}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{calc}
\newcommand{\C}{\ding{51}}
\newcommand{\X}{\ding{55}}
\begin{document}
\begin{tikzpicture}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[decoration={
markings,
mark=between positions 0.43 and 1 step 3.14cm with {\arrow{stealth};}}
]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\node at (1.5,1.5) {(\textcolor{red}{\C})}; % for checkmark
\node at (1.5,1.5) {(\textcolor{red}{\X})}; % for crossmark
\pgfmathcos{15}
\xdef\mya{\pgfmathresult}
\pgfmathsin{15}
\xdef\myb{\pgfmathresult}
\pgfmathcos{-75}
\xdef\myc{\pgfmathresult}
\pgfmathsin{-75}
\xdef\myd{\pgfmathresult}
\xdef\mye{\pgfmathresult}
\xdef\myf{\pgfmathresult}
\draw[blue,thick,postaction={decorate}] (0,0) circle (1cm);
\draw[orange,thick,postaction={decorate}] (\mye,\myf) circle (1cm);
\draw[fill] (\mya,\myb) circle (.05cm);
\draw[fill=white,draw=black] (\myc,\myd) circle (.05cm);
\begin{pgfonlayer}{background}
line width=1pt,fill=white,inner sep=2mm]{};
{Subtractive color};
\end{pgfonlayer}
\end{tikzpicture}
\end{document}

• Welcome to TeX.SX! Please help us (and also you) and add a minimal working example (MWE). This isn't a "Please do my work for me" site! What do you have so far? Try to create first one single figure. Aug 2, 2017 at 14:52
• For the tick and cross you can for example have a look in the comprehensive symbol list and find appropriate characters. As for \foreach, that is defined by TikZ, so look at TikZ' manual. Aug 2, 2017 at 16:52

I'm not entirely sure if this is the correct output, so please have a close look. There are some comments in the code, ask if anything is unclear.

\documentclass[border={10}]{standalone}
\usepackage{tikz}
\usepackage{amssymb}
\usepackage{pifont}
\usetikzlibrary{
decorations.markings,
backgrounds,
fit,
positioning,
}
\newcommand{\Checkmark}{\ding{51}}
\newcommand{\Cross}{\ding{55}}
\begin{document}
\begin{tikzpicture}
[
cwa/.style={ %clockwisearrows
decoration={
markings,
mark=at position 0.43 with {\arrow{stealth}},
mark=at position 0.93 with {\arrow{stealth}}
},
postaction=decorate},
ccwa/.style={ %counterclockwisearrows
decoration={
markings,
mark=at position 0.4 with {\arrowreversed{stealth}},
mark=at position 0.9 with {\arrowreversed{stealth}}
},
postaction=decorate},
bluecirc/.style={blue,thick},
orangecirc/.style={orange,thick},
declare function={
}
]

% set up some counter that is used to make the A,B,C,... labels
\newcounter{leftcnt}
\newcounter{rightcnt}

% the count is 1,2,3,....
% the loop variables \ba and \oa (blue arrows, orange arrows)
% refer to the styles for (counter)-clockwise arrow tip markings defined above
\foreach [count=\i] \ba/\oa in {ccwa/cwa,ccwa/ccwa,cwa/ccwa,cwa/ccwa}
{
% draw the panels on the left side
\begin{scope}[
% shift panels down
% if you change the Radius, you need to change this as well
yshift=-\i*2.5cm,
% give name to the bounding box of the stuff inside this scope
local bounding box=left\i
]
\coordinate (c1) at (0,0);
% Define center of the orange circle. "Radius" is defined above with declare function.
% We can do calculations directly in the coordinate, but need {} when the expr contains commas or parenthesis, i.e.
% ({ <x-expression> }, { <y-expression> })
% draw circles, with arrow styles as defined by the loop variables

\end{scope}

% draw the panels on the right side
% as above, but with an xshift added to move them to the right
\begin{scope}[xshift=3cm,yshift=-\i*2.5cm,local bounding box=right\i]
% the first part is the same as for the left panels
\coordinate (c1) at (0,0);

\begin{scope}
% we need a scope to limit the effect of the clipping
% draw a blue circle on on top of the orange one,
% but because of the clipping, only the part inside the original blue circle
% is visible
\end{scope}
\begin{scope}
% as previous scope, but for the orange circle
\end{scope}

% draw the black/white dots on top of the circle segments
\end{scope}

\node [right=2mm,yshift=-5pt] at (left\i.north east) {(\textcolor{red}{\Checkmark})};
\node [right=2mm,yshift=-5pt] at (right\i.north east) {(\textcolor{red}{\Cross})};
\begin{scope}[on background layer]
% set the counters appropriately, so that the first row has 1 and 2,
% second row has 3 and 4, etc.
\pgfmathsetcounter{leftcnt}{2*\i-1}
\pgfmathsetcounter{rightcnt}{2*\i}

line width=1pt,fill=white,inner sep=2mm]{};
line width=1pt,fill=white,inner sep=2mm]{};

% \Alph prints the value of a counter as a capital letter,
% i.e. 1 is A, 2 is B, etc.
{fig. \Alph{leftcnt}};
{fig. \Alph{rightcnt}};
\end{scope}
} % end of loop

\end{tikzpicture}
\end{document}

• Thanks for you reply!Actually,I would prefer every checkmark and bracket to be right of the every figure like the first picture. Aug 3, 2017 at 13:21
• @D.Matthew Right, missed that. Just move them to outside the scopes, and position them relative to the left\i/\right\i nodes (which are defined by the local bounding box). See updated code. Aug 3, 2017 at 13:33

A suggested solution is via Tikz.

The code is

\documentclass[border={10}]{standalone}
\usepackage{tikz}
\usepackage{amssymb}
\usepackage{pifont}
\usetikzlibrary{decorations.markings}
\newcommand{\C}{\ding{51}}
\newcommand{\X}{\ding{55}}

\begin{document}
\begin{tikzpicture}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[decoration={
markings,
mark=between positions .4 and 1.0 step 3cm with {\arrow{stealth};}}
]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\node at (1.5,1.5) {(\textcolor{red}{\C})}; % for checkmark
\node at (1.5,1.5) {(\textcolor{red}{\X})}; % for crossmark
\draw[blue,thick,postaction={decorate}] (-.5, .5) circle (1cm);
\draw[orange,thick,postaction={decorate}] ( .5,-.5) circle (1cm);
\draw[fill] (.5,.5) circle (.05cm);
\draw[fill=white,draw=black] (-.5,-.5) circle (.05cm);
\end{tikzpicture}
\end{document}


Slightly unnecessary TikZ tick and cross:

\documentclass[border=5]{standalone}
\usepackage{tikz}
\tikzset{%
tick/.pic={
\draw [x=1ex, y=1ex, line width=0.25ex,
red, line cap=round, line join=round, looseness=0.444]
(3/2,3) to [bend right]  (0,0) to [bend right] (-1,1);
},
cross/.pic={
\draw [x=1ex, y=1ex, line width=0.25ex,
red, line cap=round, line join=round, looseness=0.444]
(1,2) to [bend right]  (-1,0) (1, 0)  to [bend right] (-1,2);
}
}
\def\tikztick{\tikz[baseline=0.75ex]\pic{tick};}
\def\tikzcross{\tikz[baseline=0.5ex]\pic{cross};}

\begin{document}
(\tikzcross) (\tikztick)
\end{document}