3

I have made the following diagram, I would like to know a practical or a proper way to draw it in an easier way.

\documentclass[border=4mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes.multipart,arrows.meta,positioning,fit}
\begin{document}
\def\firstcircle{(-2,0) circle (1.5)}
\def\secondcircle{(0,0) circle (1.5)}
\begin{tikzpicture}
% letterings and missing pieces:
%\draw[step=0.5cm,gray,very thin] (-4,-2) grid (2,2); %Lineas guias
\draw[align=center] \firstcircle ;
\draw[align=center] \secondcircle ;
\draw[->] (1.5,0) -- (2,0) ;
\draw[->] (-3.5,0) -- (-4,0) ;
\draw[->] (-5,0.3) -- (-5,0.7);
\draw[->] (-5,-0.35) -- (-5,-0.75);
\draw[->] (3,0.3) -- (3,0.7);
\draw[->] (3,-0.35) -- (3,-0.75);
\node at (0.5, 0) {\scriptsize \textbf{Qualitative}};
\node at (-2.5, 0) {\scriptsize \textbf{Quantitative}};
\node at (3,0.15) {\scriptsize Interviews};
\node at (3,-0.2) {\scriptsize Documentary Research};
\node at (-5,0.15) {\scriptsize Secondary Data};
\node at (-5,-0.2) {\scriptsize Panel Set};
\node at (-5,1.35) {\tiny \textbf{Living Standars Measurement Survey}};
\node at (-5,1) {\tiny \textbf{1993,~98,~01,~05,~2014}};
\node at (-5,-1.05) {\tiny \textbf{Latinobarómetro:}};
\node at (-5,-1.40) {\tiny \textbf{1996 to 2015}};
\node at (3,1.35) {\tiny \textbf{Government, Private Sector}}; 
\node at (3,1) {\tiny \textbf{Workers and Labor Unions}};
\node at (3,-1.05) {\tiny \textbf{National Human Development PLan}};
\end{tikzpicture}
\end{document}

enter image description here

I would like to get "Quantitative" and "Qualitative" in the middle of each circle and without crossing them.

2 Answers2

5

I would suggest something like this. This approach also uses relative positioning from the positioning library. It utilises sans serif fonts, which often do better in diagrams. For the smallest font sizes, it uses Latin Modern Quotation Sans, which is designed especially for legibility at small sizes. I'm assuming the small sizes are due to limited space, but this diagram is only marginally bigger and could be made even smaller than the original if really necessary.

relative positioning & specialist fonts

The code for this picture is

\begin{tikzpicture}
  [
    basic/.style={align=center},
    small node/.style={font=\quotefont\scriptsize},
    tiny node/.style={font=\quotefont\tiny, inner ysep=0pt},
    qual/.style={basic},
    quant/.style={basic},
    main circle/.style={circle, draw, inner sep=5mm, font=\sffamily\bfseries\small, text width=25mm, text centered},
    arrow line/.style={->, shorten >=2pt},
    main arrow/.style={<-, shorten >=2pt},
    >=Latex,
  ]
  \node (ql) [main circle, qual] {Qualitative};
  \node (qt) [main circle, left=of ql.center, quant] {Quantitative};
  \node (qlr) [small node, qual, right=5mm of ql] {Interviews\\Documentary Research};
  \node (qtr) [small node, quant, left=5mm of qt] {Secondary Data\\Panel Set};
  \node (qlo) [tiny node, qual, anchor=north] at (ql.north -| qlr) {Government\\Private Sector\\Workers \& Labor Unions};
  \node (qlp) [tiny node, qual, anchor=south] at (ql.south -| qlr) {National Human\\Development Plan};
  \node (qts) [tiny node, quant, anchor=north] at (ql.north -| qtr) {Living Standards\\Measurement Survey\\1993,\thinspace 98,\thinspace01,\thinspace 05,\thinspace 2014};
  \node (qtm) [tiny node, quant, anchor=south] at (ql.south -| qtr) {Latinobarómetro\\1996--2015};
  \draw [main arrow] (qlr) edge [arrow line] (qlo) edge [arrow line] (qlp) -- (ql);
  \draw [main arrow] (qtr) edge [arrow line] (qts) edge [arrow line] (qtm) -- (qt);
\end{tikzpicture}

The idea of the styles is to make it easy to change the formatting in a flexible and consistent way:

  • small node for the smaller nodes;
  • tiny node for the smallest ones;
  • main circle for the circular nodes;
  • qual for nodes on the qualitative side;
  • quant for those on the quantitative side;
  • basic for formatting common to qualitative and quantitative nodes;
  • arrow line for the up/down arrows;
  • main arrow for the left/right ones.

As it stands above, qual and quant are redundant as they just include basic. However, the benefit of this approach is the ability to experiment freely and modify the formatting consistently. For example, suppose we add and redefine styles as follows, using the shadows.blur library:

    ...
    colour me/.style={text=#1, draw=#1},
    side node/.style={rounded corners,fill=white, thick, blur shadow},
    small node/.style={font=\quotefont\scriptsize, side node},
    tiny node/.style={font=\quotefont\tiny, side node},
    qual/.style={basic, colour me=magenta},
    quant/.style={basic, colour me=blue!75!cyan},
    main circle/.style={circle, inner sep=5mm, font=\sffamily\bfseries\small, text width=25mm, text centered, line width=1pt},
    ...

restyled example

If we want a shadow behind the circles, things get a bit trickier. For this, we probably need to edit the picture code itself, as well.

For this, we might add a special style

    main circle first pass/.style={main circle, basic, blur shadow, fill=white, colour me=white},

and then begin our picture

  \node (qt-1) [main circle first pass] {Quantitative};
  \node (ql-1) [main circle first pass, right=of qt-1.center] {Qualitative};
  \node (ql) [main circle, qual] at (ql-1) {Qualitative};
  \node (qt) [main circle, quant] at (qt-1) {Quantitative};

This is a cheap way to keep the shadows in the background.

shadowed circles

If you need to avoid colour, it is still possible to give the diagram some more depth. For example, we might simply adapt quant and qual

    qual/.style={basic, colour me=darkgray},
    quant/.style={basic, colour me=darkgray},

perhaps adding darkgray to the definitions of the arrows:

greyscale version

Complete code:

\documentclass[tikz,border=10pt]{standalone}
\usepackage[utf8]{inputenc}
\newcommand*\quotefont{\normalfont}
\newcommand*\qtfont[1]{%
  \renewcommand*\quotefont{#1}%
}
\usepackage[sf={lining,proportional},rm={lining,proportional},tt={monowidth,tabular,lining},qt=true]{cfr-lm}
\usetikzlibrary{arrows.meta,positioning,shadows.blur}
\begin{document}
\begin{tikzpicture}
  [
    basic/.style={align=center},
    small node/.style={font=\quotefont\scriptsize},
    tiny node/.style={font=\quotefont\tiny, inner ysep=0pt},
    qual/.style={basic},
    quant/.style={basic},
    main circle/.style={circle, draw, inner sep=5mm, font=\sffamily\bfseries\small, text width=25mm, text centered},
    arrow line/.style={->, shorten >=2pt},
    main arrow/.style={<-, shorten >=2pt},
    >=Latex,
  ]
  \node (ql) [main circle, qual] {Qualitative};
  \node (qt) [main circle, left=of ql.center, quant] {Quantitative};
  \node (qlr) [small node, qual, right=5mm of ql] {Interviews\\Documentary Research};
  \node (qtr) [small node, quant, left=5mm of qt] {Secondary Data\\Panel Set};
  \node (qlo) [tiny node, qual, anchor=north] at (ql.north -| qlr) {Government\\Private Sector\\Workers \& Labor Unions};
  \node (qlp) [tiny node, qual, anchor=south] at (ql.south -| qlr) {National Human\\Development Plan};
  \node (qts) [tiny node, quant, anchor=north] at (ql.north -| qtr) {Living Standards\\Measurement Survey\\1993,\thinspace 98,\thinspace01,\thinspace 05,\thinspace 2014};
  \node (qtm) [tiny node, quant, anchor=south] at (ql.south -| qtr) {Latinobarómetro\\1996--2015};
  \draw [main arrow] (qlr) edge [arrow line] (qlo) edge [arrow line] (qlp) -- (ql);
  \draw [main arrow] (qtr) edge [arrow line] (qts) edge [arrow line] (qtm) -- (qt);
\end{tikzpicture}
\begin{tikzpicture}
  [
    basic/.style={align=center},
    colour me/.style={text=#1, draw=#1},
    side node/.style={rounded corners,fill=white, thick, blur shadow},
    small node/.style={font=\quotefont\scriptsize, side node},
    tiny node/.style={font=\quotefont\tiny, side node},
    qual/.style={basic, colour me=magenta},
    quant/.style={basic, colour me=blue!75!cyan},
    main circle/.style={circle, inner sep=5mm, font=\sffamily\bfseries\small, text width=25mm, text centered, line width=1pt},
    arrow line/.style={->, shorten >=2pt},
    main arrow/.style={<-, shorten >=2pt},
    >=Latex,
  ]
  \node (ql) [main circle, qual] {Qualitative};
  \node (qt) [main circle, left=of ql.center, quant] {Quantitative};
  \node (qlr) [small node, qual, right=5mm of ql] {Interviews\\Documentary Research};
  \node (qtr) [small node, quant, left=5mm of qt] {Secondary Data\\Panel Set};
  \node (qlo) [tiny node, qual, anchor=north] at (ql.north -| qlr) {Government\\Private Sector\\Workers \& Labor Unions};
  \node (qlp) [tiny node, qual, anchor=south] at (ql.south -| qlr) {National Human\\Development Plan};
  \node (qts) [tiny node, quant, anchor=north] at (ql.north -| qtr) {Living Standards\\Measurement Survey\\1993,\thinspace 98,\thinspace01,\thinspace 05,\thinspace 2014};
  \node (qtm) [tiny node, quant, anchor=south] at (ql.south -| qtr) {Latinobarómetro\\1996--2015};
  \draw [main arrow] (qlr) edge [arrow line] (qlo) edge [arrow line] (qlp) -- (ql);
  \draw [main arrow] (qtr) edge [arrow line] (qts) edge [arrow line] (qtm) -- (qt);
\end{tikzpicture}
\begin{tikzpicture}
  [
    basic/.style={align=center},
    colour me/.style={text=#1, draw=#1},
    side node/.style={rounded corners, fill=white, thick, blur shadow},
    small node/.style={font=\quotefont\scriptsize, side node},
    tiny node/.style={font=\quotefont\tiny, side node},
    qual/.style={basic, colour me=magenta},
    quant/.style={basic, colour me=blue!75!cyan},
    main circle/.style={circle, inner sep=5mm, font=\sffamily\bfseries\small, text width=25mm, text centered, line width=1pt},
    main circle first pass/.style={main circle, basic, blur shadow, fill=white, colour me=white},
    arrow line/.style={->, shorten >=2pt},
    main arrow/.style={<-, shorten >=2pt},
    >=Latex,
  ]
  \node (qt-1) [main circle first pass] {Quantitative};
  \node (ql-1) [main circle first pass, right=of qt-1.center] {Qualitative};
  \node (ql) [main circle, qual] at (ql-1) {Qualitative};
  \node (qt) [main circle, quant] at (qt-1) {Quantitative};
  \node (qlr) [small node, qual, right=5mm of ql] {Interviews\\Documentary Research};
  \node (qtr) [small node, quant, left=5mm of qt] {Secondary Data\\Panel Set};
  \node (qlo) [tiny node, qual, anchor=north] at (ql.north -| qlr) {Government\\Private Sector\\Workers \& Labor Unions};
  \node (qlp) [tiny node, qual, anchor=south] at (ql.south -| qlr) {National Human\\Development Plan};
  \node (qts) [tiny node, quant, anchor=north] at (ql.north -| qtr) {Living Standards\\Measurement Survey\\1993,\thinspace 98,\thinspace01,\thinspace 05,\thinspace 2014};
  \node (qtm) [tiny node, quant, anchor=south] at (ql.south -| qtr) {Latinobarómetro\\1996--2015};
  \draw [main arrow] (qlr) edge [arrow line] (qlo) edge [arrow line] (qlp) -- (ql);
  \draw [main arrow] (qtr) edge [arrow line] (qts) edge [arrow line] (qtm) -- (qt);
\end{tikzpicture}
\begin{tikzpicture}
  [
    basic/.style={align=center},
    colour me/.style={text=#1, draw=#1},
    side node/.style={rounded corners, fill=white, thick, blur shadow},
    small node/.style={font=\quotefont\scriptsize, side node},
    tiny node/.style={font=\quotefont\tiny, side node},
    qual/.style={basic, colour me=darkgray},
    quant/.style={basic, colour me=darkgray},
    main circle/.style={circle, inner sep=5mm, font=\sffamily\bfseries\small, text width=25mm, text centered, line width=1pt},
    main circle first pass/.style={main circle, basic, blur shadow, fill=white, colour me=white},
    arrow line/.style={->, shorten >=2pt, darkgray},
    main arrow/.style={<-, shorten >=2pt, darkgray},
    >=Latex,
  ]
  \node (qt-1) [main circle first pass] {Quantitative};
  \node (ql-1) [main circle first pass, right=of qt-1.center] {Qualitative};
  \node (ql) [main circle, qual] at (ql-1) {Qualitative};
  \node (qt) [main circle, quant] at (qt-1) {Quantitative};
  \node (qlr) [small node, qual, right=5mm of ql] {Interviews\\Documentary Research};
  \node (qtr) [small node, quant, left=5mm of qt] {Secondary Data\\Panel Set};
  \node (qlo) [tiny node, qual, anchor=north] at (ql.north -| qlr) {Government\\Private Sector\\Workers \& Labor Unions};
  \node (qlp) [tiny node, qual, anchor=south] at (ql.south -| qlr) {National Human\\Development Plan};
  \node (qts) [tiny node, quant, anchor=north] at (ql.north -| qtr) {Living Standards\\Measurement Survey\\1993,\thinspace 98,\thinspace01,\thinspace 05,\thinspace 2014};
  \node (qtm) [tiny node, quant, anchor=south] at (ql.south -| qtr) {Latinobarómetro\\1996--2015};
  \draw [main arrow] (qlr) edge [arrow line] (qlo) edge [arrow line] (qlp) -- (ql);
  \draw [main arrow] (qtr) edge [arrow line] (qts) edge [arrow line] (qtm) -- (qt);
\end{tikzpicture}
\end{document}
cfr
  • 198,882
  • wau! you provide complete study! (+1) – Zarko Nov 26 '16 at 22:07
  • Thank you! Actually, what I meant with the no crossing, it's that they are centered (align) but they don't touch each other, when I tried to center them, they always touched each other. You really gave me a really helpful way to make it easier. Just in case, I used Fira Fonts. – Maximiliano Rodriguez Nov 27 '16 at 09:45
  • @cfr How can I change the arrow size from qtr (ie., secondary data - panel set) to qlp (ie., Living Standards...)? I would like to have the arrow size a bit smaller. Similar to the arrow from qt to qtr. – Maximiliano Rodriguez Nov 27 '16 at 10:26
  • @MaximilianoRodriguez I guess you mean the length. It is really just a function of the distance between the nodes. So you could place the nodes differently by changing the alignment. Right now the nodes are aligned on each side with the top/bottom edges of the circles. If you shift the nodes, either you have to make the circles smaller or you change don't align them. Or you could leave the nodes and shorten the arrow. shorten >=<dimension> or shorten <=<dimension>. There's an example of this in the cod already. I'm not sure which of these possibilities you want. – cfr Nov 27 '16 at 15:51
2

Here's my take on how to draw things by defining nodes. I've defined two coordinates for the centre of each circle and placed the label (Qualitative/Quantitative) relative to those coordinates, then drawn the circle as a node using lcentre/rcentre as the centre, drawing the circle as a node allows me to using \draw[->] (rcirc) -- (interviews) ; where the arrow automatically goes from the edge of the circle (rather than the centre) to the relative label. Depending on exact needs it may be preferable to use (rcirc.east) which specifically gives the start point as the right-most point of the circle.

I've positioned just four things precisely (ignoring the Qualitative/Quantitative labelling and the radius of the circle), the centre of the two circles and the nodes "Interviews \ Documentary Research" and "Secondary Data \ Panel Set" in both casesthey seem to be a single element so I've combined them into a single node (using Manual/automatic line breaks and text alignment in TikZ nodes) rather than having two nodes close together.

The remaining nodes are positioned by \node (livingstandards) [above=of secondarydata] which automatically positions the node relative to an existing node (I think there is some room to specify more precisely the gap between the two nodes etc.) then all connecting arrows are written like \draw[->] (rcirc) -- (interviews) ; so if the nodes move, the arrows will automatically track this rather than needing to update hard-wired coordinates.

\documentclass[border=4mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes.multipart,arrows.meta,positioning,fit}
\begin{document}

\begin{tikzpicture}
\coordinate [label={[centered,xshift=-0.5cm]:\scriptsize \textbf{Quantitative}}] (lcentre) at (-2,0);
\coordinate [label={[centered,xshift=0.5cm]:\scriptsize \textbf{Qualitative}}](rcentre) at (0,0);
\node (lcirc) [circle,draw,minimum width=3cm] at (lcentre) {};
\node (rcirc) [circle,draw,minimum width=3cm] at (rcentre) {};
\node (interviews) at (4,0) [align=center,font=\scriptsize] { Interviews \\  Documentary Research};
\node (secondarydata) at (-6,0) [align=center,font=\scriptsize] { Secondary Data \\ Panel Set};
\node (livingstandards) [above=of secondarydata] [align=center,font=\tiny\bfseries] {Living Standards Measurement Survey \\ 1993,~98,~01,~05,~2014};
\node (latinobarometro) [below=of secondarydata] [align=center,font=\tiny\bfseries] {Latinobarómetro: \\ 1996 to 2015};
\node (government) [above=of interviews] [align=center,font=\tiny\bfseries] {Government, Private Sector \\ Workers and Labor Unions};
\node (nhdp) [below=of interviews] [align=center,font=\tiny\bfseries] {National Human Development Plan};
\draw[->] (rcirc) -- (interviews) ;
\draw[->] (lcirc) -- (secondarydata) ;
\draw[->] (secondarydata) -- (livingstandards);
\draw[->] (secondarydata) -- (latinobarometro);
\draw[->] (interviews) -- (government);
\draw[->] (interviews) -- (nhdp);
\end{tikzpicture}
\end{document}

Producing enter image description here

Dai Bowen
  • 6,117