2

I am relatively new to diagram in latex.

Basically, I want to draw a diagram as shown below. It does not be exact same, but around that content.

enter image description here

\usepackage{tikz}
\begin{tikzpicture}

\draw (2,2) circle (3cm);

\end{tikzpicture}

enter link description here

aan
  • 2,663

1 Answers1

6

None of this is difficult and most of the things have already been done somewhere. So all you need to do is to google and to patch the pieces from here and there together. The ring shading is from here, the fancy arrow is from here and the rest is from the pgf manual.

\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{decorations.pathreplacing,calc} 
\makeatletter%https://tex.stackexchange.com/a/82432
\pgfdeclareradialshading[tikz@ball]{ring}{\pgfpoint{0cm}{0cm}}%
{rgb(0cm)=(1,1,1);
rgb(0.719cm)=(1,1,1);
rgb(0.72cm)=(1,1,1);
color(0.9cm)=(tikz@ball!60)}
\tikzoption{ring color}{\pgfutil@colorlet{tikz@ball}{#1}\def\tikz@shading{ring}\tikz@addmode{\tikz@mode@shadetrue}}
\makeatother
\begin{document}
\begin{tikzpicture}[fancy arrow/.style={decorate,decoration={ % https://tex.stackexchange.com/a/500018
 show path construction, 
 curveto code={ 
 \draw[top color=blue!30,bottom color=blue] 
 let \p1=($(\tikzinputsegmentsupporta)-(\tikzinputsegmentfirst)$) in 
 [/utils/exec=\pgfmathsetmacro{\mysign}{sign(\x1)}] 
 ([yshift=-3.5pt]\tikzinputsegmentfirst) .. controls 
 ([yshift=-3.5pt]\tikzinputsegmentsupporta) and ([yshift=-3.5pt]\tikzinputsegmentsupportb) 
 ..([yshift=-3.5pt,xshift=\mysign*3pt]\tikzinputsegmentlast) 
 -- ([yshift=-3.5pt,xshift=\mysign*3.5pt]\tikzinputsegmentlast) 
 -- ([yshift=-5.5pt,xshift=\mysign*3.5pt]\tikzinputsegmentlast) 
 -- (\tikzinputsegmentlast) 
 -- ([yshift=5.5pt,xshift=\mysign*3.5pt]\tikzinputsegmentlast) 
 -- ([yshift=3.5pt,xshift=\mysign*3.5pt]\tikzinputsegmentlast) 
 .. controls 
 ([yshift=3.5pt]\tikzinputsegmentsupportb) and ([yshift=3.5pt]\tikzinputsegmentsupporta) 
 .. ([yshift=3.5pt]\tikzinputsegmentfirst) -- cycle;}}},
 pics/fancy circle/.style={code={
 \path[even odd rule,fill=#1!60,path picture={
 \draw[line width=6mm,#1!20] ([yshift=3mm]path picture bounding box.west)
 to[out=-20,in=-120] ([xshift=5mm]path picture bounding box.north);
 }]  
 circle[radius=\pgfkeysvalueof{/tikz/fancy circle/radius}] 
 circle[radius=0.8*\pgfkeysvalueof{/tikz/fancy circle/radius}];
 \path[even odd rule,ring color=#1] 
  circle[radius=0.8*\pgfkeysvalueof{/tikz/fancy circle/radius}]
  circle[radius=0.8*\pgfkeysvalueof{/tikz/fancy circle/radius}-1mm];}},
 fancy circle/radius/.initial=1.55cm,
 pics/arr/.style={code={\draw[#1,top color=#1!20,bottom color=#1]
 (45:0.5) -- ++ (0.3,0) -- ++ (-45:0.5) -- ++(-135:0.5) --++ (-0.3,0)
 -- ++ (45:0.5) -- cycle;}}] 
%
 \path(-4,0) pic{fancy circle=blue} node[font=\large\sffamily]{AAA} 
  (-2.7,0) pic{arr=blue}
  (0,0) pic{fancy circle=purple} node[font=\sffamily]{Transformation} 
  (1.3,0) pic{arr=purple}
  (4,0) pic{fancy circle=orange} node[font=\large\sffamily]{AAA} ;
 \path (0,-2.5) node[top color=white,bottom color=green!30,rounded
  corners=3pt,draw=green!40,font=\sffamily\Large,minimum height=1cm,
  minimum width=2cm](H) {HUMAN};
 \draw[fancy arrow] (H.east) to[out=0,in=0,looseness=1.5]++(0,1);
 \draw[fancy arrow] ([yshift=1cm]H.west)
  to[out=180,in=180,looseness=1.5] (H.west);
\end{tikzpicture}
\end{document}

enter image description here

  • how do you cancel the shading in the circle? Thanks – aan Aug 23 '19 at 19:48
  • How can add into my document file? It seemed like standalone. I am using \documentclass[12pt,oneside]{book} – aan Aug 23 '19 at 19:54
  • 1
    @aan Just replace \documentclass[tikz,border=3mm]{standalone} by \documentclass[12pt,oneside]{book} \usepackage{tikz}. To remove the shading of the circles, remove \path[even odd rule,ring color=#1] circle[radius=0.8*\pgfkeysvalueof{/tikz/fancy circle/radius}] circle[radius=0.8*\pgfkeysvalueof{/tikz/fancy circle/radius}-1mm];. –  Aug 23 '19 at 20:19
  • Thanks! It works. Which part to remove the 2 white part in the circle? The white box in the ring of the circle? – aan Aug 23 '19 at 20:33
  • 1
    @aan It is ,path picture={ \draw[line width=6mm,#1!20] ([yshift=3mm]path picture bounding box.west) to[out=-20,in=-120] ([xshift=5mm]path picture bounding box.north); }. If you just want to draw a node in a circle, say \node[circle,draw,line width=5mm,minimum size=3.2cm]{blabla} at (<x>,<y>);. –  Aug 23 '19 at 20:36
  • Thanks, where can i put the label of this figure? will it be \caption{This is a black box} \label{fig:fig_1} \end{tikzpicture} But not working – aan Aug 23 '19 at 21:02
  • 1
    @aan You need to add \begin{figure} before \begin{tikzpicture} and \caption{This is a black box} \label{fig:fig_1}\end{figure} after \end{tikzpicture}. –  Aug 23 '19 at 21:03
  • it is an awesome diagram, but how can I jump the line of the text inside the circles? Thanks. – Julio César Cruz Monterrosas Aug 27 '19 at 23:35
  • @JulioCésarCruzMonterrosas Add e.g. align=center to the options of the corresponding nodes. Notice also that it is not very difficult to make the circles adjust to the sizes of the texts, but this deserves a new question. –  Aug 28 '19 at 02:27