8

I want to draw a figure as shown.

\documentclass[journal,comsoc]{IEEEtran}
\usepackage{tikz}
\usetikzlibrary{mindmap}
\usetikzlibrary{positioning}

\begin{document}
\begin{figure}[!ht]
    \centering
    \begin{tikzpicture}[baseline, mindmap, grow cyclic, text width=2.0pt, minimum size=0.1pt, align=flush center, every node/.style=concept, concept color=blue!20!white,opacity=0.90,
        level 1/.append style={level distance=2.5cm,sibling angle=60},
            ]
        \node[concept,ball color=blue!20!white,opacity=0.90, minimum size=3.5em, text width=5em ]{\textbf{Features}}
             child  {node [text width=3.8em, circle,ball color=blue!30, minimum size=3.0em]{K}}
            child  {node [text width=3.8em, circle,ball color=blue!30, minimum size=3.0em]{A}}
                    child  {node [text width=3.9em, circle,ball color=blue!30, minimum size=3.0em]{P}}
                     child  {node [text width=3.8em, circle,ball color=blue!30, minimum size=3.0em]{Z}}
                    child  {node [text width=3.8em, circle,ball color=blue!30, minimum size=3.0em]{MM}}
                   child  {node [text width=3.8em, circle,ball color=blue!30, minimum size=3.0em]{Q}
             };
    \end{tikzpicture}
         \caption{Features.} \label{fig:features}
        \end{figure}

\end{document}

I want to know how can I replace connecting lines by arrows as shown in figure

3 Answers3

12

Edit: Drawing this (simple) diagram with pure tikz package directly in document is not so difficult. In this you need to do the following:

  • define nodes style (color as parameter, size with text width and align of multi line text with align=center (or flush center when you not liked eventual hyphenation of node's text)
  • define distance between centers of the planet and satellite node
  • draw satellite and arrows between \planetandsatelite`s nodes in loop, which determine color of satellites and text in it:
\documentclass[journal,comsoc]{IEEEtran}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\usepackage{caption}

\begin{document}
\begin{figure}
    \centering
\begin{tikzpicture}[
   planet/.style = {circle, draw=blue, semithick, fill=blue!30,
                    font=\large\bfseries, 
                    text width=24mm, inner sep=1mm,align=center}, %<---
satellite/.style = {circle, draw=#1, semithick, fill=#1!30,
                    text width=16mm, inner sep=1mm, align=center},%<---
      arr/.style = {-{Triangle[length=3mm,width=6mm]}, color=#1,
                    line width=3mm, shorten <=1mm, shorten >=1mm}
                    ]
% planet
\node (p)   [planet]    {Features};
% satellites and connections
\foreach \i/\j [count=\k] in {red/K, cyan/A, purple/P, teal/Z, orange/lack of resistance, yellow/Q}
{
    \node (s\k) [satellite=\i] at (\k*60:3.4) {\j};
    \draw[arr=\i] (p) -- (s\k);
}
    \end{tikzpicture}
\caption{Cycle of Interaction}
\end{figure}
\end{document}

which gives:

enter image description here

First version of answer:

Like this (reconstruction of showed image)?

enter image description here

For such diagrams is designed the smartdiagram package:

\documentclass{article}
\usepackage{smartdiagram}
\usetikzlibrary{arrows.meta}
\usepackage{caption}

\begin{document}
\begin{figure}
\smartdiagramset{  
    planet font=\large\bfseries,planet text width=28mm,
    satellite font=\normalsize\bfseries, satellite text width=22mm,
    distance planet-satellite=44mm,
/tikz/connection planet satellite/.append style={-{Triangle[length=3mm,width=6mm]},
                                                 line width=3mm},
                }
\centering
\smartdiagram[constellation diagram]%
{
% text in the planet
Chaleneges of Blockchain, 
% texts in satellites  
Privacy,    Authentication,     Bandwidth,          Bootstraping,   
Usability,  Data Malleability,  Wasted Resources,   Scalability%
}
\caption{Cycle of Interaction}
\end{figure}
\end{document}

or with six satellites with text given in your MWE:

enter image description here

\documentclass{article}
\usepackage{smartdiagram}
\usepackage{caption}

\begin{document}
\begin{figure}
\smartdiagramset{
    planet font=\large\bfseries, planet text width=5em, 
    satellite font=\normalsize, 
                }
\centering
\smartdiagram[constellation diagram]%
{
% text in the planet
Features,
% texts in satellites
K, A, P, Z, MM, Q%
}
\caption{Cycle of Interaction}
\end{figure}
\end{document}

Addendum: I overlooked which document class is used ... unfortunately smartdiagram doesn't work with IEEEtran document class (yet). To resolve this incompatibility there is two possibilities:

  • draw above proposition with standalone package and than import resulted pdf` file into document. For example:
\documentclass[tikz, margin=1pt]{standalone}
\usetikzlibrary{arrows.meta}

\begin{document}
\begin{tikzpicture}[
   planet/.style = {circle, draw=blue, semithick, fill=blue!30,
                    font=\large\bfseries, inner sep=2mm},
satellite/.style = {circle, draw=#1, semithick, fill=#1!30, 
                    minimum size=4em, inner sep=2mm},
      arr/.style = {-{Triangle[length=3mm,width=6mm]}, color=#1,
                    line width=3mm, shorten <=1mm, shorten >=1mm}
                    ]
% planet
\node (p)   [planet]    {Features};
% satellites and connections
\foreach \i/\j [count=\k] in {red/K, cyan/A, purple/P, teal/Z, orange/MM, yellow/Q}
{
    \node (s\k) [satellite=\i] at (\k*60:3.2) {\j};
    \draw[arr=\i] (p) -- (s\k);
}
    \end{tikzpicture}
\end{document}

which generate image as shown the second example above and insert its pdf file (for example named cycle-smartdiagram) in your document as follows:

\documentclass[journal,comsoc]{IEEEtran}
\usetikzlibrary{arrows.meta}

\begin{document}
\begin{figure}[h!]
    \centering
\includegraphics{cycle-smartdiagram}% or whatever name you select
\caption{Cycle of Interaction}
\label{fig:cycle}
\end{figure}
\end{document}
  • draw this (simple) diagram with pure tikz package directly in document (see edit on the top of answer)
Zarko
  • 296,517
  • 3
    Good answer. But OP's documentclass is IEEEtran and there is conflict with smartdiagram. –  Jan 05 '20 at 12:24
  • 1
    ups, I overlooked which document class is used. it is pity that ,,,,,,,IEEEtrans doesn't wok with this interesting package ... – Zarko Jan 05 '20 at 12:28
  • such problems are solved with Ipe:) – 314159. Jan 05 '20 at 12:31
  • @314159. solved with lpe?, :-) –  Jan 05 '20 at 12:44
  • thank you for your kind help. Can you please tell me how can I adjust the size of the circle? for example, if I have a bit more text to add in a circle then how can I resize it. – user3582228 Jan 06 '20 at 13:10
  • @user3582228, well, you select another answer with different approach to solve your problem, so I don't see how I can help you (I'm not familiar with mindmap). In my answer in the last example the size of the planet node are determined with contained text in it and with minimum size in the sattelite nodes. In other examples are predefined in \smartdiagramset. Olease be more specific. – Zarko Jan 06 '20 at 13:20
  • Thank you zarko. I select your answer as my solution. I choose the last option you have mentioned. "pure tikz package directly in the document" – user3582228 Jan 06 '20 at 13:26
  • @user3582228, ah, you meanwhile change the mind ... please tel me, for which example you are interested please give an example of text in the ``planetnode and one ofsatellitenode. – Zarko Jan 06 '20 at 13:26
  • example text can be "lack of resistance". so, in that case, how can wrap text in the circle. Currently, if I add a bit lengthy words then size of the circle grows with it and whole beauty is gone. – user3582228 Jan 06 '20 at 13:30
  • @Zarko thank you so much. Its perfect now :) – user3582228 Jan 07 '20 at 01:23
5

Here's one solution. I've hidden the default mind map connectors (using concept color=none) and used the arrows.meta library to create new arrow connectors.

(Update @Zarko's arrows are similar to mine, but more simply implemented. I used unnecessarily complex code from another document of mine. I'll switch to his arrows, but leave my answer to show an answer using a mind map.)

\documentclass{standalone}

\usepackage{tikz}
\usetikzlibrary{mindmap,arrows.meta}

\begin{document}
\begin{tikzpicture}[
    mindmap, every node/.style={concept, ball color=blue!30},
    concept color=none, grow cyclic,
    mindmapArrow/.style={-{Triangle[length=3mm,width=6mm]},
                         color=blue!20!white, line width=3mm,
                         shorten <=2mm, shorten >=2mm},
    root concept/.append style={minimum size=3.5em, text width=5em,
    font=\bfseries},
    level 1/.append style={sibling angle=60, level distance=2.5cm,
      minimum size=3em, text width=2em}]
  \node (root) [root concept] {Features}
    child { node (child1) {K} }
    child { node (child2) {A} }
    child { node (child3) {P} }
    child { node (child4) {Z} }
    child { node (child5) {MM} }
    child { node (child6) {Q} };
  \foreach \child in {1,...,6} {
    \draw[mindmapArrow] (root) -- (child\child);
  }
\end{tikzpicture}
\end{document}

Output

David Purton
  • 25,884
  • +1, but every circle connection bar/.append style={append after command={[fill=none]}} is useless in your code. – AndréC Jan 05 '20 at 14:23
  • @AndréC, you're right! I had trouble removing the default connectors. But I see that concept color=none takes care of things. I didn't put this in until later. – David Purton Jan 06 '20 at 06:41
2

Maybe you can try to use a different (and much simpler) approach by the one based on \begin{tikzpicture}, etc..

For example, you can make your life easier if you use the Ipe program (http://ipe.otfried.org), which is free. Then you can easily draw your diagram and even use fonts of LaTeX and colours with different opacity. As it is well known, the exported .eps file by Ipe, can be included in your .tex file as follows

\begin{figure}[h!] 
    \centering
    \includegraphics[scale=0.6]{name.eps}
    \caption{...}
    \label{fig:..}
\end{figure}    

I hope this helps and provides a simpler solution.

Here is an example: enter image description here

314159.
  • 149