How to add subcaption to tikz

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
2
down vote

favorite












I need to place three tikz pictures side by side, and assign one caption to the triple and a subcaption to each tikz.



I currently use subcaption package and it works well. However, I need migrate to another template in which subfig package and subfloat command are used.
The subcaption package and the subfig package can not be used together, and it is impractical to modify the subfloat related codes. Hence, I need to use other method to achieve the same thing as the subcaption command.



This is what I want:
enter image description here



And I use these codes to generate it:



documentclass[preprint,12pt]article

usepackageamsmath
% usepackagesubfig
usepackagecaption
usepackagesubcaption
usepackagetikz
usetikzlibraryfit,positioning,arrows,automata,calc

usepackagelineno

begindocument
beginfigure[!thb]
beginminipage0.320textwidth
centering
begintikzpicture
tikzstylemain=[circle, minimum size = 5.5mm, thick, draw =black!80, node distance = 3mm]
tikzstyleconnect=[-latex, thick]
node[main,fill=black!30] (i) small $i$;
node[main] (above_i) [above left=of i] ;
node[main] (left_i) [left=of i] ;
node[main] (right_i) [right=of i] ;
node[main] (right_above_i) [above right=of i, above left=of right_i] ;
node[main] (temp1) [below=of left_i] ;
node[main] (temp2) [below=of right_i] ;
path[line width=0.03cm] (i) edge node (above_i);
path[line width=0.03cm] (i) edge node (left_i);
path[line width=0.03cm] (i) edge node (right_i);
path[line width=0.03cm] (above_i) edge node (left_i);
path[line width=0.03cm] (right_i) edge node (right_above_i);
path[line width=0.03cm] (i) edge node (right_above_i);
path[line width=0.03cm] (temp1) edge node (temp2);
path[line width=0.03cm] (temp1) edge node (left_i);
path[line width=0.03cm] (temp2) edge node (right_i);
endtikzpicture
captionsetup[subfigure]width=0.8textwidth
subcaptionsmall Subcaption (a)
labelsubfig:Event1
endminipage%
beginminipage0.320textwidth
centering
begintikzpicture
tikzstylemain=[circle, minimum size = 5.5mm, thick, draw =black!80, node distance = 3mm]
tikzstyleconnect=[-latex, thick]
node[main] (i) small $i$;
node[main] (above_i) [above left=of i] ;
node[main] (left_i) [left=of i] ;
node[main,fill=black!30] (right_i) [right=of i] ;
node[main] (right_above_i) [above right=of i, above left=of right_i] ;
node[main] (temp1) [below=of left_i] ;
node[main] (temp2) [below=of right_i] ;
path[line width=0.03cm] (i) edge node (above_i);
path[line width=0.03cm] (i) edge node (left_i);
path[line width=0.03cm] (i) edge node (right_i);
path[line width=0.03cm] (above_i) edge node (left_i);
path[line width=0.03cm] (right_i) edge node (right_above_i);
path[line width=0.03cm] (i) edge node (right_above_i);
path[line width=0.03cm] (temp1) edge node (temp2);
path[line width=0.03cm] (temp1) edge node (left_i);
path[line width=0.03cm] (temp2) edge node (right_i);
endtikzpicture
captionsetup[subfigure]width=0.8textwidth
subcaptionsmall Subcaption (b)
labelsubfig:Event2
endminipage%
beginminipage0.320textwidth
centering
begintikzpicture
tikzstylemain=[circle, minimum size = 5.5mm, thick, draw =black!80, node distance = 3mm]
tikzstyleconnect=[-latex, thick]
node[main] (i) small $i$;
node[main] (above_i) [above left=of i] ;
node[main,fill=black!30] (left_i) [left=of i] ;
node[main] (right_i) [right=of i] ;
node[main] (right_above_i) [above right=of i, above left=of right_i] ;
node[main] (temp1) [below=of left_i] ;
node[main] (temp2) [below=of right_i] ;
path[line width=0.03cm] (i) edge node (above_i);
path[line width=0.03cm] (i) edge node (left_i);
path[line width=0.03cm] (i) edge node (right_i);
path[line width=0.03cm] (above_i) edge node (left_i);
path[line width=0.03cm] (right_i) edge node (right_above_i);
path[line width=0.03cm] (i) edge node (right_above_i);
path[line width=0.03cm] (temp1) edge node (temp2);
path[line width=0.03cm] (temp1) edge node (left_i);
path[line width=0.03cm] (temp2) edge node (right_i);
endtikzpicture
captionsetup[subfigure]width=0.8textwidth
subcaptionsmall Subcaption (c)
labelsubfig:Event3
endminipage
vspace-0.2cm
captionsetupwidth=0.98textwidth
captionsmall Caption
labelfig:threeEvents
vspace-0.2cm
endfigure

sectionConclusion
We build a linear regression model to predict the next value of each instrument.

enddocument



In short, how can I achieve the above configuration WITHOUT using the subcaption package?










share|improve this question

























    up vote
    2
    down vote

    favorite












    I need to place three tikz pictures side by side, and assign one caption to the triple and a subcaption to each tikz.



    I currently use subcaption package and it works well. However, I need migrate to another template in which subfig package and subfloat command are used.
    The subcaption package and the subfig package can not be used together, and it is impractical to modify the subfloat related codes. Hence, I need to use other method to achieve the same thing as the subcaption command.



    This is what I want:
    enter image description here



    And I use these codes to generate it:



    documentclass[preprint,12pt]article

    usepackageamsmath
    % usepackagesubfig
    usepackagecaption
    usepackagesubcaption
    usepackagetikz
    usetikzlibraryfit,positioning,arrows,automata,calc

    usepackagelineno

    begindocument
    beginfigure[!thb]
    beginminipage0.320textwidth
    centering
    begintikzpicture
    tikzstylemain=[circle, minimum size = 5.5mm, thick, draw =black!80, node distance = 3mm]
    tikzstyleconnect=[-latex, thick]
    node[main,fill=black!30] (i) small $i$;
    node[main] (above_i) [above left=of i] ;
    node[main] (left_i) [left=of i] ;
    node[main] (right_i) [right=of i] ;
    node[main] (right_above_i) [above right=of i, above left=of right_i] ;
    node[main] (temp1) [below=of left_i] ;
    node[main] (temp2) [below=of right_i] ;
    path[line width=0.03cm] (i) edge node (above_i);
    path[line width=0.03cm] (i) edge node (left_i);
    path[line width=0.03cm] (i) edge node (right_i);
    path[line width=0.03cm] (above_i) edge node (left_i);
    path[line width=0.03cm] (right_i) edge node (right_above_i);
    path[line width=0.03cm] (i) edge node (right_above_i);
    path[line width=0.03cm] (temp1) edge node (temp2);
    path[line width=0.03cm] (temp1) edge node (left_i);
    path[line width=0.03cm] (temp2) edge node (right_i);
    endtikzpicture
    captionsetup[subfigure]width=0.8textwidth
    subcaptionsmall Subcaption (a)
    labelsubfig:Event1
    endminipage%
    beginminipage0.320textwidth
    centering
    begintikzpicture
    tikzstylemain=[circle, minimum size = 5.5mm, thick, draw =black!80, node distance = 3mm]
    tikzstyleconnect=[-latex, thick]
    node[main] (i) small $i$;
    node[main] (above_i) [above left=of i] ;
    node[main] (left_i) [left=of i] ;
    node[main,fill=black!30] (right_i) [right=of i] ;
    node[main] (right_above_i) [above right=of i, above left=of right_i] ;
    node[main] (temp1) [below=of left_i] ;
    node[main] (temp2) [below=of right_i] ;
    path[line width=0.03cm] (i) edge node (above_i);
    path[line width=0.03cm] (i) edge node (left_i);
    path[line width=0.03cm] (i) edge node (right_i);
    path[line width=0.03cm] (above_i) edge node (left_i);
    path[line width=0.03cm] (right_i) edge node (right_above_i);
    path[line width=0.03cm] (i) edge node (right_above_i);
    path[line width=0.03cm] (temp1) edge node (temp2);
    path[line width=0.03cm] (temp1) edge node (left_i);
    path[line width=0.03cm] (temp2) edge node (right_i);
    endtikzpicture
    captionsetup[subfigure]width=0.8textwidth
    subcaptionsmall Subcaption (b)
    labelsubfig:Event2
    endminipage%
    beginminipage0.320textwidth
    centering
    begintikzpicture
    tikzstylemain=[circle, minimum size = 5.5mm, thick, draw =black!80, node distance = 3mm]
    tikzstyleconnect=[-latex, thick]
    node[main] (i) small $i$;
    node[main] (above_i) [above left=of i] ;
    node[main,fill=black!30] (left_i) [left=of i] ;
    node[main] (right_i) [right=of i] ;
    node[main] (right_above_i) [above right=of i, above left=of right_i] ;
    node[main] (temp1) [below=of left_i] ;
    node[main] (temp2) [below=of right_i] ;
    path[line width=0.03cm] (i) edge node (above_i);
    path[line width=0.03cm] (i) edge node (left_i);
    path[line width=0.03cm] (i) edge node (right_i);
    path[line width=0.03cm] (above_i) edge node (left_i);
    path[line width=0.03cm] (right_i) edge node (right_above_i);
    path[line width=0.03cm] (i) edge node (right_above_i);
    path[line width=0.03cm] (temp1) edge node (temp2);
    path[line width=0.03cm] (temp1) edge node (left_i);
    path[line width=0.03cm] (temp2) edge node (right_i);
    endtikzpicture
    captionsetup[subfigure]width=0.8textwidth
    subcaptionsmall Subcaption (c)
    labelsubfig:Event3
    endminipage
    vspace-0.2cm
    captionsetupwidth=0.98textwidth
    captionsmall Caption
    labelfig:threeEvents
    vspace-0.2cm
    endfigure

    sectionConclusion
    We build a linear regression model to predict the next value of each instrument.

    enddocument



    In short, how can I achieve the above configuration WITHOUT using the subcaption package?










    share|improve this question























      up vote
      2
      down vote

      favorite









      up vote
      2
      down vote

      favorite











      I need to place three tikz pictures side by side, and assign one caption to the triple and a subcaption to each tikz.



      I currently use subcaption package and it works well. However, I need migrate to another template in which subfig package and subfloat command are used.
      The subcaption package and the subfig package can not be used together, and it is impractical to modify the subfloat related codes. Hence, I need to use other method to achieve the same thing as the subcaption command.



      This is what I want:
      enter image description here



      And I use these codes to generate it:



      documentclass[preprint,12pt]article

      usepackageamsmath
      % usepackagesubfig
      usepackagecaption
      usepackagesubcaption
      usepackagetikz
      usetikzlibraryfit,positioning,arrows,automata,calc

      usepackagelineno

      begindocument
      beginfigure[!thb]
      beginminipage0.320textwidth
      centering
      begintikzpicture
      tikzstylemain=[circle, minimum size = 5.5mm, thick, draw =black!80, node distance = 3mm]
      tikzstyleconnect=[-latex, thick]
      node[main,fill=black!30] (i) small $i$;
      node[main] (above_i) [above left=of i] ;
      node[main] (left_i) [left=of i] ;
      node[main] (right_i) [right=of i] ;
      node[main] (right_above_i) [above right=of i, above left=of right_i] ;
      node[main] (temp1) [below=of left_i] ;
      node[main] (temp2) [below=of right_i] ;
      path[line width=0.03cm] (i) edge node (above_i);
      path[line width=0.03cm] (i) edge node (left_i);
      path[line width=0.03cm] (i) edge node (right_i);
      path[line width=0.03cm] (above_i) edge node (left_i);
      path[line width=0.03cm] (right_i) edge node (right_above_i);
      path[line width=0.03cm] (i) edge node (right_above_i);
      path[line width=0.03cm] (temp1) edge node (temp2);
      path[line width=0.03cm] (temp1) edge node (left_i);
      path[line width=0.03cm] (temp2) edge node (right_i);
      endtikzpicture
      captionsetup[subfigure]width=0.8textwidth
      subcaptionsmall Subcaption (a)
      labelsubfig:Event1
      endminipage%
      beginminipage0.320textwidth
      centering
      begintikzpicture
      tikzstylemain=[circle, minimum size = 5.5mm, thick, draw =black!80, node distance = 3mm]
      tikzstyleconnect=[-latex, thick]
      node[main] (i) small $i$;
      node[main] (above_i) [above left=of i] ;
      node[main] (left_i) [left=of i] ;
      node[main,fill=black!30] (right_i) [right=of i] ;
      node[main] (right_above_i) [above right=of i, above left=of right_i] ;
      node[main] (temp1) [below=of left_i] ;
      node[main] (temp2) [below=of right_i] ;
      path[line width=0.03cm] (i) edge node (above_i);
      path[line width=0.03cm] (i) edge node (left_i);
      path[line width=0.03cm] (i) edge node (right_i);
      path[line width=0.03cm] (above_i) edge node (left_i);
      path[line width=0.03cm] (right_i) edge node (right_above_i);
      path[line width=0.03cm] (i) edge node (right_above_i);
      path[line width=0.03cm] (temp1) edge node (temp2);
      path[line width=0.03cm] (temp1) edge node (left_i);
      path[line width=0.03cm] (temp2) edge node (right_i);
      endtikzpicture
      captionsetup[subfigure]width=0.8textwidth
      subcaptionsmall Subcaption (b)
      labelsubfig:Event2
      endminipage%
      beginminipage0.320textwidth
      centering
      begintikzpicture
      tikzstylemain=[circle, minimum size = 5.5mm, thick, draw =black!80, node distance = 3mm]
      tikzstyleconnect=[-latex, thick]
      node[main] (i) small $i$;
      node[main] (above_i) [above left=of i] ;
      node[main,fill=black!30] (left_i) [left=of i] ;
      node[main] (right_i) [right=of i] ;
      node[main] (right_above_i) [above right=of i, above left=of right_i] ;
      node[main] (temp1) [below=of left_i] ;
      node[main] (temp2) [below=of right_i] ;
      path[line width=0.03cm] (i) edge node (above_i);
      path[line width=0.03cm] (i) edge node (left_i);
      path[line width=0.03cm] (i) edge node (right_i);
      path[line width=0.03cm] (above_i) edge node (left_i);
      path[line width=0.03cm] (right_i) edge node (right_above_i);
      path[line width=0.03cm] (i) edge node (right_above_i);
      path[line width=0.03cm] (temp1) edge node (temp2);
      path[line width=0.03cm] (temp1) edge node (left_i);
      path[line width=0.03cm] (temp2) edge node (right_i);
      endtikzpicture
      captionsetup[subfigure]width=0.8textwidth
      subcaptionsmall Subcaption (c)
      labelsubfig:Event3
      endminipage
      vspace-0.2cm
      captionsetupwidth=0.98textwidth
      captionsmall Caption
      labelfig:threeEvents
      vspace-0.2cm
      endfigure

      sectionConclusion
      We build a linear regression model to predict the next value of each instrument.

      enddocument



      In short, how can I achieve the above configuration WITHOUT using the subcaption package?










      share|improve this question













      I need to place three tikz pictures side by side, and assign one caption to the triple and a subcaption to each tikz.



      I currently use subcaption package and it works well. However, I need migrate to another template in which subfig package and subfloat command are used.
      The subcaption package and the subfig package can not be used together, and it is impractical to modify the subfloat related codes. Hence, I need to use other method to achieve the same thing as the subcaption command.



      This is what I want:
      enter image description here



      And I use these codes to generate it:



      documentclass[preprint,12pt]article

      usepackageamsmath
      % usepackagesubfig
      usepackagecaption
      usepackagesubcaption
      usepackagetikz
      usetikzlibraryfit,positioning,arrows,automata,calc

      usepackagelineno

      begindocument
      beginfigure[!thb]
      beginminipage0.320textwidth
      centering
      begintikzpicture
      tikzstylemain=[circle, minimum size = 5.5mm, thick, draw =black!80, node distance = 3mm]
      tikzstyleconnect=[-latex, thick]
      node[main,fill=black!30] (i) small $i$;
      node[main] (above_i) [above left=of i] ;
      node[main] (left_i) [left=of i] ;
      node[main] (right_i) [right=of i] ;
      node[main] (right_above_i) [above right=of i, above left=of right_i] ;
      node[main] (temp1) [below=of left_i] ;
      node[main] (temp2) [below=of right_i] ;
      path[line width=0.03cm] (i) edge node (above_i);
      path[line width=0.03cm] (i) edge node (left_i);
      path[line width=0.03cm] (i) edge node (right_i);
      path[line width=0.03cm] (above_i) edge node (left_i);
      path[line width=0.03cm] (right_i) edge node (right_above_i);
      path[line width=0.03cm] (i) edge node (right_above_i);
      path[line width=0.03cm] (temp1) edge node (temp2);
      path[line width=0.03cm] (temp1) edge node (left_i);
      path[line width=0.03cm] (temp2) edge node (right_i);
      endtikzpicture
      captionsetup[subfigure]width=0.8textwidth
      subcaptionsmall Subcaption (a)
      labelsubfig:Event1
      endminipage%
      beginminipage0.320textwidth
      centering
      begintikzpicture
      tikzstylemain=[circle, minimum size = 5.5mm, thick, draw =black!80, node distance = 3mm]
      tikzstyleconnect=[-latex, thick]
      node[main] (i) small $i$;
      node[main] (above_i) [above left=of i] ;
      node[main] (left_i) [left=of i] ;
      node[main,fill=black!30] (right_i) [right=of i] ;
      node[main] (right_above_i) [above right=of i, above left=of right_i] ;
      node[main] (temp1) [below=of left_i] ;
      node[main] (temp2) [below=of right_i] ;
      path[line width=0.03cm] (i) edge node (above_i);
      path[line width=0.03cm] (i) edge node (left_i);
      path[line width=0.03cm] (i) edge node (right_i);
      path[line width=0.03cm] (above_i) edge node (left_i);
      path[line width=0.03cm] (right_i) edge node (right_above_i);
      path[line width=0.03cm] (i) edge node (right_above_i);
      path[line width=0.03cm] (temp1) edge node (temp2);
      path[line width=0.03cm] (temp1) edge node (left_i);
      path[line width=0.03cm] (temp2) edge node (right_i);
      endtikzpicture
      captionsetup[subfigure]width=0.8textwidth
      subcaptionsmall Subcaption (b)
      labelsubfig:Event2
      endminipage%
      beginminipage0.320textwidth
      centering
      begintikzpicture
      tikzstylemain=[circle, minimum size = 5.5mm, thick, draw =black!80, node distance = 3mm]
      tikzstyleconnect=[-latex, thick]
      node[main] (i) small $i$;
      node[main] (above_i) [above left=of i] ;
      node[main,fill=black!30] (left_i) [left=of i] ;
      node[main] (right_i) [right=of i] ;
      node[main] (right_above_i) [above right=of i, above left=of right_i] ;
      node[main] (temp1) [below=of left_i] ;
      node[main] (temp2) [below=of right_i] ;
      path[line width=0.03cm] (i) edge node (above_i);
      path[line width=0.03cm] (i) edge node (left_i);
      path[line width=0.03cm] (i) edge node (right_i);
      path[line width=0.03cm] (above_i) edge node (left_i);
      path[line width=0.03cm] (right_i) edge node (right_above_i);
      path[line width=0.03cm] (i) edge node (right_above_i);
      path[line width=0.03cm] (temp1) edge node (temp2);
      path[line width=0.03cm] (temp1) edge node (left_i);
      path[line width=0.03cm] (temp2) edge node (right_i);
      endtikzpicture
      captionsetup[subfigure]width=0.8textwidth
      subcaptionsmall Subcaption (c)
      labelsubfig:Event3
      endminipage
      vspace-0.2cm
      captionsetupwidth=0.98textwidth
      captionsmall Caption
      labelfig:threeEvents
      vspace-0.2cm
      endfigure

      sectionConclusion
      We build a linear regression model to predict the next value of each instrument.

      enddocument



      In short, how can I achieve the above configuration WITHOUT using the subcaption package?







      tikz-pgf subfloats subcaption incompatibility






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 3 hours ago









      user3813057

      1303




      1303




















          3 Answers
          3






          active

          oldest

          votes

















          up vote
          2
          down vote













          Sth like this?



          documentclass[preprint,12pt]article

          usepackageamsmath
          usepackagesubfig
          usepackagecaption
          usepackagetikz
          usetikzlibrarypositioning

          usepackagelineno

          captionsetup[subfloat]width=0.7textwidth
          tikzsetmain/.style=circle, minimum size = 5.5mm, thick, draw
          =black!80, node distance = 3mm,connect/.style=-latex, thick
          begindocument
          beginfigure[!thb]
          beginminipage0.320textwidth
          centering
          subfloat[small Subcaption (a)labelsubfig:Event1]
          begintikzpicture
          node[main,fill=black!30] (i) small $i$;
          node[main] (above_i) [above left=of i] ;
          node[main] (left_i) [left=of i] ;
          node[main] (right_i) [right=of i] ;
          node[main] (right_above_i) [above right=of i, above left=of right_i] ;
          node[main] (temp1) [below=of left_i] ;
          node[main] (temp2) [below=of right_i] ;
          path[line width=0.03cm] (i) edge node (above_i);
          path[line width=0.03cm] (i) edge node (left_i);
          path[line width=0.03cm] (i) edge node (right_i);
          path[line width=0.03cm] (above_i) edge node (left_i);
          path[line width=0.03cm] (right_i) edge node (right_above_i);
          path[line width=0.03cm] (i) edge node (right_above_i);
          path[line width=0.03cm] (temp1) edge node (temp2);
          path[line width=0.03cm] (temp1) edge node (left_i);
          path[line width=0.03cm] (temp2) edge node (right_i);
          endtikzpicture

          endminipage%
          beginminipage0.320textwidth
          centering
          subfloat[small Subcaption (b)labelsubfig:Event2]
          begintikzpicture
          node[main] (i) small $i$;
          node[main] (above_i) [above left=of i] ;
          node[main] (left_i) [left=of i] ;
          node[main,fill=black!30] (right_i) [right=of i] ;
          node[main] (right_above_i) [above right=of i, above left=of right_i] ;
          node[main] (temp1) [below=of left_i] ;
          node[main] (temp2) [below=of right_i] ;
          path[line width=0.03cm] (i) edge node (above_i);
          path[line width=0.03cm] (i) edge node (left_i);
          path[line width=0.03cm] (i) edge node (right_i);
          path[line width=0.03cm] (above_i) edge node (left_i);
          path[line width=0.03cm] (right_i) edge node (right_above_i);
          path[line width=0.03cm] (i) edge node (right_above_i);
          path[line width=0.03cm] (temp1) edge node (temp2);
          path[line width=0.03cm] (temp1) edge node (left_i);
          path[line width=0.03cm] (temp2) edge node (right_i);
          endtikzpicture

          endminipage%
          beginminipage0.320textwidth
          centering
          subfloat[small Subcaption~(c)labelsubfig:Event3]
          begintikzpicture
          node[main] (i) small $i$;
          node[main] (above_i) [above left=of i] ;
          node[main,fill=black!30] (left_i) [left=of i] ;
          node[main] (right_i) [right=of i] ;
          node[main] (right_above_i) [above right=of i, above left=of right_i] ;
          node[main] (temp1) [below=of left_i] ;
          node[main] (temp2) [below=of right_i] ;
          path[line width=0.03cm] (i) edge node (above_i);
          path[line width=0.03cm] (i) edge node (left_i);
          path[line width=0.03cm] (i) edge node (right_i);
          path[line width=0.03cm] (above_i) edge node (left_i);
          path[line width=0.03cm] (right_i) edge node (right_above_i);
          path[line width=0.03cm] (i) edge node (right_above_i);
          path[line width=0.03cm] (temp1) edge node (temp2);
          path[line width=0.03cm] (temp1) edge node (left_i);
          path[line width=0.03cm] (temp2) edge node (right_i);
          endtikzpicture

          endminipage
          vspace-0.2cm
          captionsetupwidth=0.98textwidth
          captionsmall Caption
          labelfig:threeEvents
          vspace-0.2cm
          endfigure

          sectionConclusion
          We build a linear regression model to predict the next value of each instrument.

          enddocument


          enter image description here






          share|improve this answer



























            up vote
            1
            down vote













            This is more of a long comment. In particular, this answer should not be awarded a green tick because I all that I am doing is rewriting marmot's nice solution in a more compact way. Up votes are, of course, fine:)



            Rather than repeating this large chunk of code for each regression model I recommend defining a macro to do this. The only difference between the three different models used is which node is shaded. The code below defines a macro Model that takes one argument that tells it which node should filled. For example, Model1, Model4 and Model3 will produce the diagrams in the OP. This is done by adding a new style to each of the nodes and then changing the style for node #1 in the macro (the numbering of the nodes is the order that they appear in the OP).



            As shown below, the output is the same as in marmot's solution but the code is shorter and easier to read:



            documentclass[preprint,12pt]article

            usepackageamsmath
            usepackagesubfig

            usepackagecaption
            captionsetup[subfloat]width=0.7textwidth

            usepackagelineno

            usepackagetikz
            usetikzlibrarypositioning
            tikzset
            main/.style=circle, minimum size = 5.5mm, thick, draw
            =black!80, node distance = 3mm,
            connect/.style=-latex, thick,
            node 1/.style=, % default node styles
            node 2/.style=,
            node 3/.style=,
            node 4/.style=,
            node 5/.style=,
            node 6/.style=,
            node 7/.style=,


            newcommandModel[1]
            begintikzpicture
            tikzsetnode #1/.style=fill=black!30% change the style of node #1
            node[main, node 1] (i) small $i$;
            node[main, node 2] (above_i) [above left=of i] ;
            node[main, node 3] (left_i) [left=of i] ;
            node[main, node 4] (right_i) [right=of i] ;
            node[main, node 5] (right_above_i) [above right=of i, above left=of right_i] ;
            node[main, node 6] (temp1) [below=of left_i] ;
            node[main, node 7] (temp2) [below=of right_i] ;
            path[line width=0.03cm] (i) edge node (above_i);
            path[line width=0.03cm] (i) edge node (left_i);
            path[line width=0.03cm] (i) edge node (right_i);
            path[line width=0.03cm] (above_i) edge node (left_i);
            path[line width=0.03cm] (right_i) edge node (right_above_i);
            path[line width=0.03cm] (i) edge node (right_above_i);
            path[line width=0.03cm] (temp1) edge node (temp2);
            path[line width=0.03cm] (temp1) edge node (left_i);
            path[line width=0.03cm] (temp2) edge node (right_i);
            endtikzpicture


            begindocument
            beginfigure[!thb]
            beginminipage0.320textwidth
            centering
            subfloat[small Subcaption (a)labelsubfig:Event1] Model1
            endminipage%
            beginminipage0.320textwidth
            centering
            subfloat[small Subcaption (b)labelsubfig:Event2] Model4
            endminipage%
            beginminipage0.320textwidth
            centering
            subfloat[small Subcaption~(c)labelsubfig:Event3] Model3
            endminipage
            vspace-0.2cm
            captionsetupwidth=0.98textwidth
            captionsmall Caption
            labelfig:threeEvents
            vspace-0.2cm
            endfigure

            enddocument


            You should be able to adapt this idea to typeset other similar models if you need them in other parts of your document. You might also want to include the minipage and caption in the Model macro.



            To confirm that this works, here is the output:



            enter image description here






            share|improve this answer



























              up vote
              0
              down vote













              It is possible to write the text with tikz below each figure. To do this, simply place this text in the node below the edge that joins the two lower circles:



               path[line width=0.03cm] (temp1) edge node[shift=(.1,-.7),font=small] Subcaption (b) (temp2);


              caption



              documentclass[preprint,12pt]article

              usepackageamsmath

              usepackagesubfig
              usepackagecaption
              %usepackagesubcaption
              usepackagetikz
              usetikzlibraryfit,positioning,arrows,automata,calc

              usepackagelineno

              begindocument
              beginfigure[!thb]
              beginminipage0.320textwidth
              centering
              begintikzpicture
              tikzstylemain=[circle, minimum size = 5.5mm, thick, draw =black!80, node distance = 3mm]
              tikzstyleconnect=[-latex, thick]
              node[main,fill=black!30] (i) small $i$;
              node[main] (above_i) [above left=of i] ;
              node[main] (left_i) [left=of i] ;
              node[main] (right_i) [right=of i] ;
              node[main] (right_above_i) [above right=of i, above left=of right_i] ;
              node[main] (temp1) [below=of left_i] ;
              node[main] (temp2) [below=of right_i] ;
              path[line width=0.03cm] (i) edge node (above_i);
              path[line width=0.03cm] (i) edge node (left_i);
              path[line width=0.03cm] (i) edge node (right_i);
              path[line width=0.03cm] (above_i) edge node (left_i);
              path[line width=0.03cm] (right_i) edge node (right_above_i);
              path[line width=0.03cm] (i) edge node (right_above_i);
              path[line width=0.03cm] (temp1) edge node[shift=(0,-.7),font=small] Subcaption (a) (temp2);
              path[line width=0.03cm] (temp1) edge node (left_i);
              path[line width=0.03cm] (temp2) edge node (right_i);
              endtikzpicture
              captionsetup[subfigure]width=0.8textwidth
              %subcaptionsmall Subcaption (a)
              labelsubfig:Event1
              endminipage%
              beginminipage0.320textwidth
              centering
              begintikzpicture
              tikzstylemain=[circle, minimum size = 5.5mm, thick, draw =black!80, node distance = 3mm]
              tikzstyleconnect=[-latex, thick]
              node[main] (i) small $i$;
              node[main] (above_i) [above left=of i] ;
              node[main] (left_i) [left=of i] ;
              node[main,fill=black!30] (right_i) [right=of i] ;
              node[main] (right_above_i) [above right=of i, above left=of right_i] ;
              node[main] (temp1) [below=of left_i] ;
              node[main] (temp2) [below=of right_i] ;
              path[line width=0.03cm] (i) edge node (above_i);
              path[line width=0.03cm] (i) edge node (left_i);
              path[line width=0.03cm] (i) edge node (right_i);
              path[line width=0.03cm] (above_i) edge node (left_i);
              path[line width=0.03cm] (right_i) edge node (right_above_i);
              path[line width=0.03cm] (i) edge node (right_above_i);
              path[line width=0.03cm] (temp1) edge node[shift=(.1,-.7),font=small] Subcaption (b) (temp2);
              path[line width=0.03cm] (temp1) edge node (left_i);
              path[line width=0.03cm] (temp2) edge node (right_i);

              endtikzpicture
              captionsetup[subfigure]width=0.8textwidth
              %subcaptionsmall Subcaption (b)
              labelsubfig:Event2
              endminipage%
              beginminipage0.320textwidth
              centering
              begintikzpicture
              tikzstylemain=[circle, minimum size = 5.5mm, thick, draw =black!80, node distance = 3mm]
              tikzstyleconnect=[-latex, thick]
              node[main] (i) small $i$;
              node[main] (above_i) [above left=of i] ;
              node[main,fill=black!30] (left_i) [left=of i] ;
              node[main] (right_i) [right=of i] ;
              node[main] (right_above_i) [above right=of i, above left=of right_i] ;
              node[main] (temp1) [below=of left_i] ;
              node[main] (temp2) [below=of right_i] ;
              path[line width=0.03cm] (i) edge node (above_i);
              path[line width=0.03cm] (i) edge node (left_i);
              path[line width=0.03cm] (i) edge node (right_i);
              path[line width=0.03cm] (above_i) edge node (left_i);
              path[line width=0.03cm] (right_i) edge node (right_above_i);
              path[line width=0.03cm] (i) edge node (right_above_i);
              path[line width=0.03cm] (temp1) edge node[midway,shift=(.1,-.7),font=small]Subcaption (c) (temp2);
              path[line width=0.03cm] (temp1) edge node (left_i);
              path[line width=0.03cm] (temp2) edge node (right_i);
              endtikzpicture
              captionsetup[subfigure]width=0.8textwidth
              %subcaptionsmall Subcaption (c)
              labelsubfig:Event3
              endminipage
              vspace-0.2cm
              captionsetupwidth=0.98textwidth
              captionsmall Caption
              labelfig:threeEvents
              vspace-0.2cm
              endfigure

              sectionConclusion
              We build a linear regression model to predict the next value of each instrument.

              enddocument





              share|improve this answer




















                Your Answer







                StackExchange.ready(function()
                var channelOptions =
                tags: "".split(" "),
                id: "85"
                ;
                initTagRenderer("".split(" "), "".split(" "), channelOptions);

                StackExchange.using("externalEditor", function()
                // Have to fire editor after snippets, if snippets enabled
                if (StackExchange.settings.snippets.snippetsEnabled)
                StackExchange.using("snippets", function()
                createEditor();
                );

                else
                createEditor();

                );

                function createEditor()
                StackExchange.prepareEditor(
                heartbeatType: 'answer',
                convertImagesToLinks: false,
                noModals: false,
                showLowRepImageUploadWarning: true,
                reputationToPostImages: null,
                bindNavPrevention: true,
                postfix: "",
                onDemand: true,
                discardSelector: ".discard-answer"
                ,immediatelyShowMarkdownHelp:true
                );



                );













                 

                draft saved


                draft discarded


















                StackExchange.ready(
                function ()
                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f457283%2fhow-to-add-subcaption-to-tikz%23new-answer', 'question_page');

                );

                Post as a guest






























                3 Answers
                3






                active

                oldest

                votes








                3 Answers
                3






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes








                up vote
                2
                down vote













                Sth like this?



                documentclass[preprint,12pt]article

                usepackageamsmath
                usepackagesubfig
                usepackagecaption
                usepackagetikz
                usetikzlibrarypositioning

                usepackagelineno

                captionsetup[subfloat]width=0.7textwidth
                tikzsetmain/.style=circle, minimum size = 5.5mm, thick, draw
                =black!80, node distance = 3mm,connect/.style=-latex, thick
                begindocument
                beginfigure[!thb]
                beginminipage0.320textwidth
                centering
                subfloat[small Subcaption (a)labelsubfig:Event1]
                begintikzpicture
                node[main,fill=black!30] (i) small $i$;
                node[main] (above_i) [above left=of i] ;
                node[main] (left_i) [left=of i] ;
                node[main] (right_i) [right=of i] ;
                node[main] (right_above_i) [above right=of i, above left=of right_i] ;
                node[main] (temp1) [below=of left_i] ;
                node[main] (temp2) [below=of right_i] ;
                path[line width=0.03cm] (i) edge node (above_i);
                path[line width=0.03cm] (i) edge node (left_i);
                path[line width=0.03cm] (i) edge node (right_i);
                path[line width=0.03cm] (above_i) edge node (left_i);
                path[line width=0.03cm] (right_i) edge node (right_above_i);
                path[line width=0.03cm] (i) edge node (right_above_i);
                path[line width=0.03cm] (temp1) edge node (temp2);
                path[line width=0.03cm] (temp1) edge node (left_i);
                path[line width=0.03cm] (temp2) edge node (right_i);
                endtikzpicture

                endminipage%
                beginminipage0.320textwidth
                centering
                subfloat[small Subcaption (b)labelsubfig:Event2]
                begintikzpicture
                node[main] (i) small $i$;
                node[main] (above_i) [above left=of i] ;
                node[main] (left_i) [left=of i] ;
                node[main,fill=black!30] (right_i) [right=of i] ;
                node[main] (right_above_i) [above right=of i, above left=of right_i] ;
                node[main] (temp1) [below=of left_i] ;
                node[main] (temp2) [below=of right_i] ;
                path[line width=0.03cm] (i) edge node (above_i);
                path[line width=0.03cm] (i) edge node (left_i);
                path[line width=0.03cm] (i) edge node (right_i);
                path[line width=0.03cm] (above_i) edge node (left_i);
                path[line width=0.03cm] (right_i) edge node (right_above_i);
                path[line width=0.03cm] (i) edge node (right_above_i);
                path[line width=0.03cm] (temp1) edge node (temp2);
                path[line width=0.03cm] (temp1) edge node (left_i);
                path[line width=0.03cm] (temp2) edge node (right_i);
                endtikzpicture

                endminipage%
                beginminipage0.320textwidth
                centering
                subfloat[small Subcaption~(c)labelsubfig:Event3]
                begintikzpicture
                node[main] (i) small $i$;
                node[main] (above_i) [above left=of i] ;
                node[main,fill=black!30] (left_i) [left=of i] ;
                node[main] (right_i) [right=of i] ;
                node[main] (right_above_i) [above right=of i, above left=of right_i] ;
                node[main] (temp1) [below=of left_i] ;
                node[main] (temp2) [below=of right_i] ;
                path[line width=0.03cm] (i) edge node (above_i);
                path[line width=0.03cm] (i) edge node (left_i);
                path[line width=0.03cm] (i) edge node (right_i);
                path[line width=0.03cm] (above_i) edge node (left_i);
                path[line width=0.03cm] (right_i) edge node (right_above_i);
                path[line width=0.03cm] (i) edge node (right_above_i);
                path[line width=0.03cm] (temp1) edge node (temp2);
                path[line width=0.03cm] (temp1) edge node (left_i);
                path[line width=0.03cm] (temp2) edge node (right_i);
                endtikzpicture

                endminipage
                vspace-0.2cm
                captionsetupwidth=0.98textwidth
                captionsmall Caption
                labelfig:threeEvents
                vspace-0.2cm
                endfigure

                sectionConclusion
                We build a linear regression model to predict the next value of each instrument.

                enddocument


                enter image description here






                share|improve this answer
























                  up vote
                  2
                  down vote













                  Sth like this?



                  documentclass[preprint,12pt]article

                  usepackageamsmath
                  usepackagesubfig
                  usepackagecaption
                  usepackagetikz
                  usetikzlibrarypositioning

                  usepackagelineno

                  captionsetup[subfloat]width=0.7textwidth
                  tikzsetmain/.style=circle, minimum size = 5.5mm, thick, draw
                  =black!80, node distance = 3mm,connect/.style=-latex, thick
                  begindocument
                  beginfigure[!thb]
                  beginminipage0.320textwidth
                  centering
                  subfloat[small Subcaption (a)labelsubfig:Event1]
                  begintikzpicture
                  node[main,fill=black!30] (i) small $i$;
                  node[main] (above_i) [above left=of i] ;
                  node[main] (left_i) [left=of i] ;
                  node[main] (right_i) [right=of i] ;
                  node[main] (right_above_i) [above right=of i, above left=of right_i] ;
                  node[main] (temp1) [below=of left_i] ;
                  node[main] (temp2) [below=of right_i] ;
                  path[line width=0.03cm] (i) edge node (above_i);
                  path[line width=0.03cm] (i) edge node (left_i);
                  path[line width=0.03cm] (i) edge node (right_i);
                  path[line width=0.03cm] (above_i) edge node (left_i);
                  path[line width=0.03cm] (right_i) edge node (right_above_i);
                  path[line width=0.03cm] (i) edge node (right_above_i);
                  path[line width=0.03cm] (temp1) edge node (temp2);
                  path[line width=0.03cm] (temp1) edge node (left_i);
                  path[line width=0.03cm] (temp2) edge node (right_i);
                  endtikzpicture

                  endminipage%
                  beginminipage0.320textwidth
                  centering
                  subfloat[small Subcaption (b)labelsubfig:Event2]
                  begintikzpicture
                  node[main] (i) small $i$;
                  node[main] (above_i) [above left=of i] ;
                  node[main] (left_i) [left=of i] ;
                  node[main,fill=black!30] (right_i) [right=of i] ;
                  node[main] (right_above_i) [above right=of i, above left=of right_i] ;
                  node[main] (temp1) [below=of left_i] ;
                  node[main] (temp2) [below=of right_i] ;
                  path[line width=0.03cm] (i) edge node (above_i);
                  path[line width=0.03cm] (i) edge node (left_i);
                  path[line width=0.03cm] (i) edge node (right_i);
                  path[line width=0.03cm] (above_i) edge node (left_i);
                  path[line width=0.03cm] (right_i) edge node (right_above_i);
                  path[line width=0.03cm] (i) edge node (right_above_i);
                  path[line width=0.03cm] (temp1) edge node (temp2);
                  path[line width=0.03cm] (temp1) edge node (left_i);
                  path[line width=0.03cm] (temp2) edge node (right_i);
                  endtikzpicture

                  endminipage%
                  beginminipage0.320textwidth
                  centering
                  subfloat[small Subcaption~(c)labelsubfig:Event3]
                  begintikzpicture
                  node[main] (i) small $i$;
                  node[main] (above_i) [above left=of i] ;
                  node[main,fill=black!30] (left_i) [left=of i] ;
                  node[main] (right_i) [right=of i] ;
                  node[main] (right_above_i) [above right=of i, above left=of right_i] ;
                  node[main] (temp1) [below=of left_i] ;
                  node[main] (temp2) [below=of right_i] ;
                  path[line width=0.03cm] (i) edge node (above_i);
                  path[line width=0.03cm] (i) edge node (left_i);
                  path[line width=0.03cm] (i) edge node (right_i);
                  path[line width=0.03cm] (above_i) edge node (left_i);
                  path[line width=0.03cm] (right_i) edge node (right_above_i);
                  path[line width=0.03cm] (i) edge node (right_above_i);
                  path[line width=0.03cm] (temp1) edge node (temp2);
                  path[line width=0.03cm] (temp1) edge node (left_i);
                  path[line width=0.03cm] (temp2) edge node (right_i);
                  endtikzpicture

                  endminipage
                  vspace-0.2cm
                  captionsetupwidth=0.98textwidth
                  captionsmall Caption
                  labelfig:threeEvents
                  vspace-0.2cm
                  endfigure

                  sectionConclusion
                  We build a linear regression model to predict the next value of each instrument.

                  enddocument


                  enter image description here






                  share|improve this answer






















                    up vote
                    2
                    down vote










                    up vote
                    2
                    down vote









                    Sth like this?



                    documentclass[preprint,12pt]article

                    usepackageamsmath
                    usepackagesubfig
                    usepackagecaption
                    usepackagetikz
                    usetikzlibrarypositioning

                    usepackagelineno

                    captionsetup[subfloat]width=0.7textwidth
                    tikzsetmain/.style=circle, minimum size = 5.5mm, thick, draw
                    =black!80, node distance = 3mm,connect/.style=-latex, thick
                    begindocument
                    beginfigure[!thb]
                    beginminipage0.320textwidth
                    centering
                    subfloat[small Subcaption (a)labelsubfig:Event1]
                    begintikzpicture
                    node[main,fill=black!30] (i) small $i$;
                    node[main] (above_i) [above left=of i] ;
                    node[main] (left_i) [left=of i] ;
                    node[main] (right_i) [right=of i] ;
                    node[main] (right_above_i) [above right=of i, above left=of right_i] ;
                    node[main] (temp1) [below=of left_i] ;
                    node[main] (temp2) [below=of right_i] ;
                    path[line width=0.03cm] (i) edge node (above_i);
                    path[line width=0.03cm] (i) edge node (left_i);
                    path[line width=0.03cm] (i) edge node (right_i);
                    path[line width=0.03cm] (above_i) edge node (left_i);
                    path[line width=0.03cm] (right_i) edge node (right_above_i);
                    path[line width=0.03cm] (i) edge node (right_above_i);
                    path[line width=0.03cm] (temp1) edge node (temp2);
                    path[line width=0.03cm] (temp1) edge node (left_i);
                    path[line width=0.03cm] (temp2) edge node (right_i);
                    endtikzpicture

                    endminipage%
                    beginminipage0.320textwidth
                    centering
                    subfloat[small Subcaption (b)labelsubfig:Event2]
                    begintikzpicture
                    node[main] (i) small $i$;
                    node[main] (above_i) [above left=of i] ;
                    node[main] (left_i) [left=of i] ;
                    node[main,fill=black!30] (right_i) [right=of i] ;
                    node[main] (right_above_i) [above right=of i, above left=of right_i] ;
                    node[main] (temp1) [below=of left_i] ;
                    node[main] (temp2) [below=of right_i] ;
                    path[line width=0.03cm] (i) edge node (above_i);
                    path[line width=0.03cm] (i) edge node (left_i);
                    path[line width=0.03cm] (i) edge node (right_i);
                    path[line width=0.03cm] (above_i) edge node (left_i);
                    path[line width=0.03cm] (right_i) edge node (right_above_i);
                    path[line width=0.03cm] (i) edge node (right_above_i);
                    path[line width=0.03cm] (temp1) edge node (temp2);
                    path[line width=0.03cm] (temp1) edge node (left_i);
                    path[line width=0.03cm] (temp2) edge node (right_i);
                    endtikzpicture

                    endminipage%
                    beginminipage0.320textwidth
                    centering
                    subfloat[small Subcaption~(c)labelsubfig:Event3]
                    begintikzpicture
                    node[main] (i) small $i$;
                    node[main] (above_i) [above left=of i] ;
                    node[main,fill=black!30] (left_i) [left=of i] ;
                    node[main] (right_i) [right=of i] ;
                    node[main] (right_above_i) [above right=of i, above left=of right_i] ;
                    node[main] (temp1) [below=of left_i] ;
                    node[main] (temp2) [below=of right_i] ;
                    path[line width=0.03cm] (i) edge node (above_i);
                    path[line width=0.03cm] (i) edge node (left_i);
                    path[line width=0.03cm] (i) edge node (right_i);
                    path[line width=0.03cm] (above_i) edge node (left_i);
                    path[line width=0.03cm] (right_i) edge node (right_above_i);
                    path[line width=0.03cm] (i) edge node (right_above_i);
                    path[line width=0.03cm] (temp1) edge node (temp2);
                    path[line width=0.03cm] (temp1) edge node (left_i);
                    path[line width=0.03cm] (temp2) edge node (right_i);
                    endtikzpicture

                    endminipage
                    vspace-0.2cm
                    captionsetupwidth=0.98textwidth
                    captionsmall Caption
                    labelfig:threeEvents
                    vspace-0.2cm
                    endfigure

                    sectionConclusion
                    We build a linear regression model to predict the next value of each instrument.

                    enddocument


                    enter image description here






                    share|improve this answer












                    Sth like this?



                    documentclass[preprint,12pt]article

                    usepackageamsmath
                    usepackagesubfig
                    usepackagecaption
                    usepackagetikz
                    usetikzlibrarypositioning

                    usepackagelineno

                    captionsetup[subfloat]width=0.7textwidth
                    tikzsetmain/.style=circle, minimum size = 5.5mm, thick, draw
                    =black!80, node distance = 3mm,connect/.style=-latex, thick
                    begindocument
                    beginfigure[!thb]
                    beginminipage0.320textwidth
                    centering
                    subfloat[small Subcaption (a)labelsubfig:Event1]
                    begintikzpicture
                    node[main,fill=black!30] (i) small $i$;
                    node[main] (above_i) [above left=of i] ;
                    node[main] (left_i) [left=of i] ;
                    node[main] (right_i) [right=of i] ;
                    node[main] (right_above_i) [above right=of i, above left=of right_i] ;
                    node[main] (temp1) [below=of left_i] ;
                    node[main] (temp2) [below=of right_i] ;
                    path[line width=0.03cm] (i) edge node (above_i);
                    path[line width=0.03cm] (i) edge node (left_i);
                    path[line width=0.03cm] (i) edge node (right_i);
                    path[line width=0.03cm] (above_i) edge node (left_i);
                    path[line width=0.03cm] (right_i) edge node (right_above_i);
                    path[line width=0.03cm] (i) edge node (right_above_i);
                    path[line width=0.03cm] (temp1) edge node (temp2);
                    path[line width=0.03cm] (temp1) edge node (left_i);
                    path[line width=0.03cm] (temp2) edge node (right_i);
                    endtikzpicture

                    endminipage%
                    beginminipage0.320textwidth
                    centering
                    subfloat[small Subcaption (b)labelsubfig:Event2]
                    begintikzpicture
                    node[main] (i) small $i$;
                    node[main] (above_i) [above left=of i] ;
                    node[main] (left_i) [left=of i] ;
                    node[main,fill=black!30] (right_i) [right=of i] ;
                    node[main] (right_above_i) [above right=of i, above left=of right_i] ;
                    node[main] (temp1) [below=of left_i] ;
                    node[main] (temp2) [below=of right_i] ;
                    path[line width=0.03cm] (i) edge node (above_i);
                    path[line width=0.03cm] (i) edge node (left_i);
                    path[line width=0.03cm] (i) edge node (right_i);
                    path[line width=0.03cm] (above_i) edge node (left_i);
                    path[line width=0.03cm] (right_i) edge node (right_above_i);
                    path[line width=0.03cm] (i) edge node (right_above_i);
                    path[line width=0.03cm] (temp1) edge node (temp2);
                    path[line width=0.03cm] (temp1) edge node (left_i);
                    path[line width=0.03cm] (temp2) edge node (right_i);
                    endtikzpicture

                    endminipage%
                    beginminipage0.320textwidth
                    centering
                    subfloat[small Subcaption~(c)labelsubfig:Event3]
                    begintikzpicture
                    node[main] (i) small $i$;
                    node[main] (above_i) [above left=of i] ;
                    node[main,fill=black!30] (left_i) [left=of i] ;
                    node[main] (right_i) [right=of i] ;
                    node[main] (right_above_i) [above right=of i, above left=of right_i] ;
                    node[main] (temp1) [below=of left_i] ;
                    node[main] (temp2) [below=of right_i] ;
                    path[line width=0.03cm] (i) edge node (above_i);
                    path[line width=0.03cm] (i) edge node (left_i);
                    path[line width=0.03cm] (i) edge node (right_i);
                    path[line width=0.03cm] (above_i) edge node (left_i);
                    path[line width=0.03cm] (right_i) edge node (right_above_i);
                    path[line width=0.03cm] (i) edge node (right_above_i);
                    path[line width=0.03cm] (temp1) edge node (temp2);
                    path[line width=0.03cm] (temp1) edge node (left_i);
                    path[line width=0.03cm] (temp2) edge node (right_i);
                    endtikzpicture

                    endminipage
                    vspace-0.2cm
                    captionsetupwidth=0.98textwidth
                    captionsmall Caption
                    labelfig:threeEvents
                    vspace-0.2cm
                    endfigure

                    sectionConclusion
                    We build a linear regression model to predict the next value of each instrument.

                    enddocument


                    enter image description here







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered 2 hours ago









                    marmot

                    69.4k476148




                    69.4k476148




















                        up vote
                        1
                        down vote













                        This is more of a long comment. In particular, this answer should not be awarded a green tick because I all that I am doing is rewriting marmot's nice solution in a more compact way. Up votes are, of course, fine:)



                        Rather than repeating this large chunk of code for each regression model I recommend defining a macro to do this. The only difference between the three different models used is which node is shaded. The code below defines a macro Model that takes one argument that tells it which node should filled. For example, Model1, Model4 and Model3 will produce the diagrams in the OP. This is done by adding a new style to each of the nodes and then changing the style for node #1 in the macro (the numbering of the nodes is the order that they appear in the OP).



                        As shown below, the output is the same as in marmot's solution but the code is shorter and easier to read:



                        documentclass[preprint,12pt]article

                        usepackageamsmath
                        usepackagesubfig

                        usepackagecaption
                        captionsetup[subfloat]width=0.7textwidth

                        usepackagelineno

                        usepackagetikz
                        usetikzlibrarypositioning
                        tikzset
                        main/.style=circle, minimum size = 5.5mm, thick, draw
                        =black!80, node distance = 3mm,
                        connect/.style=-latex, thick,
                        node 1/.style=, % default node styles
                        node 2/.style=,
                        node 3/.style=,
                        node 4/.style=,
                        node 5/.style=,
                        node 6/.style=,
                        node 7/.style=,


                        newcommandModel[1]
                        begintikzpicture
                        tikzsetnode #1/.style=fill=black!30% change the style of node #1
                        node[main, node 1] (i) small $i$;
                        node[main, node 2] (above_i) [above left=of i] ;
                        node[main, node 3] (left_i) [left=of i] ;
                        node[main, node 4] (right_i) [right=of i] ;
                        node[main, node 5] (right_above_i) [above right=of i, above left=of right_i] ;
                        node[main, node 6] (temp1) [below=of left_i] ;
                        node[main, node 7] (temp2) [below=of right_i] ;
                        path[line width=0.03cm] (i) edge node (above_i);
                        path[line width=0.03cm] (i) edge node (left_i);
                        path[line width=0.03cm] (i) edge node (right_i);
                        path[line width=0.03cm] (above_i) edge node (left_i);
                        path[line width=0.03cm] (right_i) edge node (right_above_i);
                        path[line width=0.03cm] (i) edge node (right_above_i);
                        path[line width=0.03cm] (temp1) edge node (temp2);
                        path[line width=0.03cm] (temp1) edge node (left_i);
                        path[line width=0.03cm] (temp2) edge node (right_i);
                        endtikzpicture


                        begindocument
                        beginfigure[!thb]
                        beginminipage0.320textwidth
                        centering
                        subfloat[small Subcaption (a)labelsubfig:Event1] Model1
                        endminipage%
                        beginminipage0.320textwidth
                        centering
                        subfloat[small Subcaption (b)labelsubfig:Event2] Model4
                        endminipage%
                        beginminipage0.320textwidth
                        centering
                        subfloat[small Subcaption~(c)labelsubfig:Event3] Model3
                        endminipage
                        vspace-0.2cm
                        captionsetupwidth=0.98textwidth
                        captionsmall Caption
                        labelfig:threeEvents
                        vspace-0.2cm
                        endfigure

                        enddocument


                        You should be able to adapt this idea to typeset other similar models if you need them in other parts of your document. You might also want to include the minipage and caption in the Model macro.



                        To confirm that this works, here is the output:



                        enter image description here






                        share|improve this answer
























                          up vote
                          1
                          down vote













                          This is more of a long comment. In particular, this answer should not be awarded a green tick because I all that I am doing is rewriting marmot's nice solution in a more compact way. Up votes are, of course, fine:)



                          Rather than repeating this large chunk of code for each regression model I recommend defining a macro to do this. The only difference between the three different models used is which node is shaded. The code below defines a macro Model that takes one argument that tells it which node should filled. For example, Model1, Model4 and Model3 will produce the diagrams in the OP. This is done by adding a new style to each of the nodes and then changing the style for node #1 in the macro (the numbering of the nodes is the order that they appear in the OP).



                          As shown below, the output is the same as in marmot's solution but the code is shorter and easier to read:



                          documentclass[preprint,12pt]article

                          usepackageamsmath
                          usepackagesubfig

                          usepackagecaption
                          captionsetup[subfloat]width=0.7textwidth

                          usepackagelineno

                          usepackagetikz
                          usetikzlibrarypositioning
                          tikzset
                          main/.style=circle, minimum size = 5.5mm, thick, draw
                          =black!80, node distance = 3mm,
                          connect/.style=-latex, thick,
                          node 1/.style=, % default node styles
                          node 2/.style=,
                          node 3/.style=,
                          node 4/.style=,
                          node 5/.style=,
                          node 6/.style=,
                          node 7/.style=,


                          newcommandModel[1]
                          begintikzpicture
                          tikzsetnode #1/.style=fill=black!30% change the style of node #1
                          node[main, node 1] (i) small $i$;
                          node[main, node 2] (above_i) [above left=of i] ;
                          node[main, node 3] (left_i) [left=of i] ;
                          node[main, node 4] (right_i) [right=of i] ;
                          node[main, node 5] (right_above_i) [above right=of i, above left=of right_i] ;
                          node[main, node 6] (temp1) [below=of left_i] ;
                          node[main, node 7] (temp2) [below=of right_i] ;
                          path[line width=0.03cm] (i) edge node (above_i);
                          path[line width=0.03cm] (i) edge node (left_i);
                          path[line width=0.03cm] (i) edge node (right_i);
                          path[line width=0.03cm] (above_i) edge node (left_i);
                          path[line width=0.03cm] (right_i) edge node (right_above_i);
                          path[line width=0.03cm] (i) edge node (right_above_i);
                          path[line width=0.03cm] (temp1) edge node (temp2);
                          path[line width=0.03cm] (temp1) edge node (left_i);
                          path[line width=0.03cm] (temp2) edge node (right_i);
                          endtikzpicture


                          begindocument
                          beginfigure[!thb]
                          beginminipage0.320textwidth
                          centering
                          subfloat[small Subcaption (a)labelsubfig:Event1] Model1
                          endminipage%
                          beginminipage0.320textwidth
                          centering
                          subfloat[small Subcaption (b)labelsubfig:Event2] Model4
                          endminipage%
                          beginminipage0.320textwidth
                          centering
                          subfloat[small Subcaption~(c)labelsubfig:Event3] Model3
                          endminipage
                          vspace-0.2cm
                          captionsetupwidth=0.98textwidth
                          captionsmall Caption
                          labelfig:threeEvents
                          vspace-0.2cm
                          endfigure

                          enddocument


                          You should be able to adapt this idea to typeset other similar models if you need them in other parts of your document. You might also want to include the minipage and caption in the Model macro.



                          To confirm that this works, here is the output:



                          enter image description here






                          share|improve this answer






















                            up vote
                            1
                            down vote










                            up vote
                            1
                            down vote









                            This is more of a long comment. In particular, this answer should not be awarded a green tick because I all that I am doing is rewriting marmot's nice solution in a more compact way. Up votes are, of course, fine:)



                            Rather than repeating this large chunk of code for each regression model I recommend defining a macro to do this. The only difference between the three different models used is which node is shaded. The code below defines a macro Model that takes one argument that tells it which node should filled. For example, Model1, Model4 and Model3 will produce the diagrams in the OP. This is done by adding a new style to each of the nodes and then changing the style for node #1 in the macro (the numbering of the nodes is the order that they appear in the OP).



                            As shown below, the output is the same as in marmot's solution but the code is shorter and easier to read:



                            documentclass[preprint,12pt]article

                            usepackageamsmath
                            usepackagesubfig

                            usepackagecaption
                            captionsetup[subfloat]width=0.7textwidth

                            usepackagelineno

                            usepackagetikz
                            usetikzlibrarypositioning
                            tikzset
                            main/.style=circle, minimum size = 5.5mm, thick, draw
                            =black!80, node distance = 3mm,
                            connect/.style=-latex, thick,
                            node 1/.style=, % default node styles
                            node 2/.style=,
                            node 3/.style=,
                            node 4/.style=,
                            node 5/.style=,
                            node 6/.style=,
                            node 7/.style=,


                            newcommandModel[1]
                            begintikzpicture
                            tikzsetnode #1/.style=fill=black!30% change the style of node #1
                            node[main, node 1] (i) small $i$;
                            node[main, node 2] (above_i) [above left=of i] ;
                            node[main, node 3] (left_i) [left=of i] ;
                            node[main, node 4] (right_i) [right=of i] ;
                            node[main, node 5] (right_above_i) [above right=of i, above left=of right_i] ;
                            node[main, node 6] (temp1) [below=of left_i] ;
                            node[main, node 7] (temp2) [below=of right_i] ;
                            path[line width=0.03cm] (i) edge node (above_i);
                            path[line width=0.03cm] (i) edge node (left_i);
                            path[line width=0.03cm] (i) edge node (right_i);
                            path[line width=0.03cm] (above_i) edge node (left_i);
                            path[line width=0.03cm] (right_i) edge node (right_above_i);
                            path[line width=0.03cm] (i) edge node (right_above_i);
                            path[line width=0.03cm] (temp1) edge node (temp2);
                            path[line width=0.03cm] (temp1) edge node (left_i);
                            path[line width=0.03cm] (temp2) edge node (right_i);
                            endtikzpicture


                            begindocument
                            beginfigure[!thb]
                            beginminipage0.320textwidth
                            centering
                            subfloat[small Subcaption (a)labelsubfig:Event1] Model1
                            endminipage%
                            beginminipage0.320textwidth
                            centering
                            subfloat[small Subcaption (b)labelsubfig:Event2] Model4
                            endminipage%
                            beginminipage0.320textwidth
                            centering
                            subfloat[small Subcaption~(c)labelsubfig:Event3] Model3
                            endminipage
                            vspace-0.2cm
                            captionsetupwidth=0.98textwidth
                            captionsmall Caption
                            labelfig:threeEvents
                            vspace-0.2cm
                            endfigure

                            enddocument


                            You should be able to adapt this idea to typeset other similar models if you need them in other parts of your document. You might also want to include the minipage and caption in the Model macro.



                            To confirm that this works, here is the output:



                            enter image description here






                            share|improve this answer












                            This is more of a long comment. In particular, this answer should not be awarded a green tick because I all that I am doing is rewriting marmot's nice solution in a more compact way. Up votes are, of course, fine:)



                            Rather than repeating this large chunk of code for each regression model I recommend defining a macro to do this. The only difference between the three different models used is which node is shaded. The code below defines a macro Model that takes one argument that tells it which node should filled. For example, Model1, Model4 and Model3 will produce the diagrams in the OP. This is done by adding a new style to each of the nodes and then changing the style for node #1 in the macro (the numbering of the nodes is the order that they appear in the OP).



                            As shown below, the output is the same as in marmot's solution but the code is shorter and easier to read:



                            documentclass[preprint,12pt]article

                            usepackageamsmath
                            usepackagesubfig

                            usepackagecaption
                            captionsetup[subfloat]width=0.7textwidth

                            usepackagelineno

                            usepackagetikz
                            usetikzlibrarypositioning
                            tikzset
                            main/.style=circle, minimum size = 5.5mm, thick, draw
                            =black!80, node distance = 3mm,
                            connect/.style=-latex, thick,
                            node 1/.style=, % default node styles
                            node 2/.style=,
                            node 3/.style=,
                            node 4/.style=,
                            node 5/.style=,
                            node 6/.style=,
                            node 7/.style=,


                            newcommandModel[1]
                            begintikzpicture
                            tikzsetnode #1/.style=fill=black!30% change the style of node #1
                            node[main, node 1] (i) small $i$;
                            node[main, node 2] (above_i) [above left=of i] ;
                            node[main, node 3] (left_i) [left=of i] ;
                            node[main, node 4] (right_i) [right=of i] ;
                            node[main, node 5] (right_above_i) [above right=of i, above left=of right_i] ;
                            node[main, node 6] (temp1) [below=of left_i] ;
                            node[main, node 7] (temp2) [below=of right_i] ;
                            path[line width=0.03cm] (i) edge node (above_i);
                            path[line width=0.03cm] (i) edge node (left_i);
                            path[line width=0.03cm] (i) edge node (right_i);
                            path[line width=0.03cm] (above_i) edge node (left_i);
                            path[line width=0.03cm] (right_i) edge node (right_above_i);
                            path[line width=0.03cm] (i) edge node (right_above_i);
                            path[line width=0.03cm] (temp1) edge node (temp2);
                            path[line width=0.03cm] (temp1) edge node (left_i);
                            path[line width=0.03cm] (temp2) edge node (right_i);
                            endtikzpicture


                            begindocument
                            beginfigure[!thb]
                            beginminipage0.320textwidth
                            centering
                            subfloat[small Subcaption (a)labelsubfig:Event1] Model1
                            endminipage%
                            beginminipage0.320textwidth
                            centering
                            subfloat[small Subcaption (b)labelsubfig:Event2] Model4
                            endminipage%
                            beginminipage0.320textwidth
                            centering
                            subfloat[small Subcaption~(c)labelsubfig:Event3] Model3
                            endminipage
                            vspace-0.2cm
                            captionsetupwidth=0.98textwidth
                            captionsmall Caption
                            labelfig:threeEvents
                            vspace-0.2cm
                            endfigure

                            enddocument


                            You should be able to adapt this idea to typeset other similar models if you need them in other parts of your document. You might also want to include the minipage and caption in the Model macro.



                            To confirm that this works, here is the output:



                            enter image description here







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered 2 hours ago









                            Andrew

                            28.3k34075




                            28.3k34075




















                                up vote
                                0
                                down vote













                                It is possible to write the text with tikz below each figure. To do this, simply place this text in the node below the edge that joins the two lower circles:



                                 path[line width=0.03cm] (temp1) edge node[shift=(.1,-.7),font=small] Subcaption (b) (temp2);


                                caption



                                documentclass[preprint,12pt]article

                                usepackageamsmath

                                usepackagesubfig
                                usepackagecaption
                                %usepackagesubcaption
                                usepackagetikz
                                usetikzlibraryfit,positioning,arrows,automata,calc

                                usepackagelineno

                                begindocument
                                beginfigure[!thb]
                                beginminipage0.320textwidth
                                centering
                                begintikzpicture
                                tikzstylemain=[circle, minimum size = 5.5mm, thick, draw =black!80, node distance = 3mm]
                                tikzstyleconnect=[-latex, thick]
                                node[main,fill=black!30] (i) small $i$;
                                node[main] (above_i) [above left=of i] ;
                                node[main] (left_i) [left=of i] ;
                                node[main] (right_i) [right=of i] ;
                                node[main] (right_above_i) [above right=of i, above left=of right_i] ;
                                node[main] (temp1) [below=of left_i] ;
                                node[main] (temp2) [below=of right_i] ;
                                path[line width=0.03cm] (i) edge node (above_i);
                                path[line width=0.03cm] (i) edge node (left_i);
                                path[line width=0.03cm] (i) edge node (right_i);
                                path[line width=0.03cm] (above_i) edge node (left_i);
                                path[line width=0.03cm] (right_i) edge node (right_above_i);
                                path[line width=0.03cm] (i) edge node (right_above_i);
                                path[line width=0.03cm] (temp1) edge node[shift=(0,-.7),font=small] Subcaption (a) (temp2);
                                path[line width=0.03cm] (temp1) edge node (left_i);
                                path[line width=0.03cm] (temp2) edge node (right_i);
                                endtikzpicture
                                captionsetup[subfigure]width=0.8textwidth
                                %subcaptionsmall Subcaption (a)
                                labelsubfig:Event1
                                endminipage%
                                beginminipage0.320textwidth
                                centering
                                begintikzpicture
                                tikzstylemain=[circle, minimum size = 5.5mm, thick, draw =black!80, node distance = 3mm]
                                tikzstyleconnect=[-latex, thick]
                                node[main] (i) small $i$;
                                node[main] (above_i) [above left=of i] ;
                                node[main] (left_i) [left=of i] ;
                                node[main,fill=black!30] (right_i) [right=of i] ;
                                node[main] (right_above_i) [above right=of i, above left=of right_i] ;
                                node[main] (temp1) [below=of left_i] ;
                                node[main] (temp2) [below=of right_i] ;
                                path[line width=0.03cm] (i) edge node (above_i);
                                path[line width=0.03cm] (i) edge node (left_i);
                                path[line width=0.03cm] (i) edge node (right_i);
                                path[line width=0.03cm] (above_i) edge node (left_i);
                                path[line width=0.03cm] (right_i) edge node (right_above_i);
                                path[line width=0.03cm] (i) edge node (right_above_i);
                                path[line width=0.03cm] (temp1) edge node[shift=(.1,-.7),font=small] Subcaption (b) (temp2);
                                path[line width=0.03cm] (temp1) edge node (left_i);
                                path[line width=0.03cm] (temp2) edge node (right_i);

                                endtikzpicture
                                captionsetup[subfigure]width=0.8textwidth
                                %subcaptionsmall Subcaption (b)
                                labelsubfig:Event2
                                endminipage%
                                beginminipage0.320textwidth
                                centering
                                begintikzpicture
                                tikzstylemain=[circle, minimum size = 5.5mm, thick, draw =black!80, node distance = 3mm]
                                tikzstyleconnect=[-latex, thick]
                                node[main] (i) small $i$;
                                node[main] (above_i) [above left=of i] ;
                                node[main,fill=black!30] (left_i) [left=of i] ;
                                node[main] (right_i) [right=of i] ;
                                node[main] (right_above_i) [above right=of i, above left=of right_i] ;
                                node[main] (temp1) [below=of left_i] ;
                                node[main] (temp2) [below=of right_i] ;
                                path[line width=0.03cm] (i) edge node (above_i);
                                path[line width=0.03cm] (i) edge node (left_i);
                                path[line width=0.03cm] (i) edge node (right_i);
                                path[line width=0.03cm] (above_i) edge node (left_i);
                                path[line width=0.03cm] (right_i) edge node (right_above_i);
                                path[line width=0.03cm] (i) edge node (right_above_i);
                                path[line width=0.03cm] (temp1) edge node[midway,shift=(.1,-.7),font=small]Subcaption (c) (temp2);
                                path[line width=0.03cm] (temp1) edge node (left_i);
                                path[line width=0.03cm] (temp2) edge node (right_i);
                                endtikzpicture
                                captionsetup[subfigure]width=0.8textwidth
                                %subcaptionsmall Subcaption (c)
                                labelsubfig:Event3
                                endminipage
                                vspace-0.2cm
                                captionsetupwidth=0.98textwidth
                                captionsmall Caption
                                labelfig:threeEvents
                                vspace-0.2cm
                                endfigure

                                sectionConclusion
                                We build a linear regression model to predict the next value of each instrument.

                                enddocument





                                share|improve this answer
























                                  up vote
                                  0
                                  down vote













                                  It is possible to write the text with tikz below each figure. To do this, simply place this text in the node below the edge that joins the two lower circles:



                                   path[line width=0.03cm] (temp1) edge node[shift=(.1,-.7),font=small] Subcaption (b) (temp2);


                                  caption



                                  documentclass[preprint,12pt]article

                                  usepackageamsmath

                                  usepackagesubfig
                                  usepackagecaption
                                  %usepackagesubcaption
                                  usepackagetikz
                                  usetikzlibraryfit,positioning,arrows,automata,calc

                                  usepackagelineno

                                  begindocument
                                  beginfigure[!thb]
                                  beginminipage0.320textwidth
                                  centering
                                  begintikzpicture
                                  tikzstylemain=[circle, minimum size = 5.5mm, thick, draw =black!80, node distance = 3mm]
                                  tikzstyleconnect=[-latex, thick]
                                  node[main,fill=black!30] (i) small $i$;
                                  node[main] (above_i) [above left=of i] ;
                                  node[main] (left_i) [left=of i] ;
                                  node[main] (right_i) [right=of i] ;
                                  node[main] (right_above_i) [above right=of i, above left=of right_i] ;
                                  node[main] (temp1) [below=of left_i] ;
                                  node[main] (temp2) [below=of right_i] ;
                                  path[line width=0.03cm] (i) edge node (above_i);
                                  path[line width=0.03cm] (i) edge node (left_i);
                                  path[line width=0.03cm] (i) edge node (right_i);
                                  path[line width=0.03cm] (above_i) edge node (left_i);
                                  path[line width=0.03cm] (right_i) edge node (right_above_i);
                                  path[line width=0.03cm] (i) edge node (right_above_i);
                                  path[line width=0.03cm] (temp1) edge node[shift=(0,-.7),font=small] Subcaption (a) (temp2);
                                  path[line width=0.03cm] (temp1) edge node (left_i);
                                  path[line width=0.03cm] (temp2) edge node (right_i);
                                  endtikzpicture
                                  captionsetup[subfigure]width=0.8textwidth
                                  %subcaptionsmall Subcaption (a)
                                  labelsubfig:Event1
                                  endminipage%
                                  beginminipage0.320textwidth
                                  centering
                                  begintikzpicture
                                  tikzstylemain=[circle, minimum size = 5.5mm, thick, draw =black!80, node distance = 3mm]
                                  tikzstyleconnect=[-latex, thick]
                                  node[main] (i) small $i$;
                                  node[main] (above_i) [above left=of i] ;
                                  node[main] (left_i) [left=of i] ;
                                  node[main,fill=black!30] (right_i) [right=of i] ;
                                  node[main] (right_above_i) [above right=of i, above left=of right_i] ;
                                  node[main] (temp1) [below=of left_i] ;
                                  node[main] (temp2) [below=of right_i] ;
                                  path[line width=0.03cm] (i) edge node (above_i);
                                  path[line width=0.03cm] (i) edge node (left_i);
                                  path[line width=0.03cm] (i) edge node (right_i);
                                  path[line width=0.03cm] (above_i) edge node (left_i);
                                  path[line width=0.03cm] (right_i) edge node (right_above_i);
                                  path[line width=0.03cm] (i) edge node (right_above_i);
                                  path[line width=0.03cm] (temp1) edge node[shift=(.1,-.7),font=small] Subcaption (b) (temp2);
                                  path[line width=0.03cm] (temp1) edge node (left_i);
                                  path[line width=0.03cm] (temp2) edge node (right_i);

                                  endtikzpicture
                                  captionsetup[subfigure]width=0.8textwidth
                                  %subcaptionsmall Subcaption (b)
                                  labelsubfig:Event2
                                  endminipage%
                                  beginminipage0.320textwidth
                                  centering
                                  begintikzpicture
                                  tikzstylemain=[circle, minimum size = 5.5mm, thick, draw =black!80, node distance = 3mm]
                                  tikzstyleconnect=[-latex, thick]
                                  node[main] (i) small $i$;
                                  node[main] (above_i) [above left=of i] ;
                                  node[main,fill=black!30] (left_i) [left=of i] ;
                                  node[main] (right_i) [right=of i] ;
                                  node[main] (right_above_i) [above right=of i, above left=of right_i] ;
                                  node[main] (temp1) [below=of left_i] ;
                                  node[main] (temp2) [below=of right_i] ;
                                  path[line width=0.03cm] (i) edge node (above_i);
                                  path[line width=0.03cm] (i) edge node (left_i);
                                  path[line width=0.03cm] (i) edge node (right_i);
                                  path[line width=0.03cm] (above_i) edge node (left_i);
                                  path[line width=0.03cm] (right_i) edge node (right_above_i);
                                  path[line width=0.03cm] (i) edge node (right_above_i);
                                  path[line width=0.03cm] (temp1) edge node[midway,shift=(.1,-.7),font=small]Subcaption (c) (temp2);
                                  path[line width=0.03cm] (temp1) edge node (left_i);
                                  path[line width=0.03cm] (temp2) edge node (right_i);
                                  endtikzpicture
                                  captionsetup[subfigure]width=0.8textwidth
                                  %subcaptionsmall Subcaption (c)
                                  labelsubfig:Event3
                                  endminipage
                                  vspace-0.2cm
                                  captionsetupwidth=0.98textwidth
                                  captionsmall Caption
                                  labelfig:threeEvents
                                  vspace-0.2cm
                                  endfigure

                                  sectionConclusion
                                  We build a linear regression model to predict the next value of each instrument.

                                  enddocument





                                  share|improve this answer






















                                    up vote
                                    0
                                    down vote










                                    up vote
                                    0
                                    down vote









                                    It is possible to write the text with tikz below each figure. To do this, simply place this text in the node below the edge that joins the two lower circles:



                                     path[line width=0.03cm] (temp1) edge node[shift=(.1,-.7),font=small] Subcaption (b) (temp2);


                                    caption



                                    documentclass[preprint,12pt]article

                                    usepackageamsmath

                                    usepackagesubfig
                                    usepackagecaption
                                    %usepackagesubcaption
                                    usepackagetikz
                                    usetikzlibraryfit,positioning,arrows,automata,calc

                                    usepackagelineno

                                    begindocument
                                    beginfigure[!thb]
                                    beginminipage0.320textwidth
                                    centering
                                    begintikzpicture
                                    tikzstylemain=[circle, minimum size = 5.5mm, thick, draw =black!80, node distance = 3mm]
                                    tikzstyleconnect=[-latex, thick]
                                    node[main,fill=black!30] (i) small $i$;
                                    node[main] (above_i) [above left=of i] ;
                                    node[main] (left_i) [left=of i] ;
                                    node[main] (right_i) [right=of i] ;
                                    node[main] (right_above_i) [above right=of i, above left=of right_i] ;
                                    node[main] (temp1) [below=of left_i] ;
                                    node[main] (temp2) [below=of right_i] ;
                                    path[line width=0.03cm] (i) edge node (above_i);
                                    path[line width=0.03cm] (i) edge node (left_i);
                                    path[line width=0.03cm] (i) edge node (right_i);
                                    path[line width=0.03cm] (above_i) edge node (left_i);
                                    path[line width=0.03cm] (right_i) edge node (right_above_i);
                                    path[line width=0.03cm] (i) edge node (right_above_i);
                                    path[line width=0.03cm] (temp1) edge node[shift=(0,-.7),font=small] Subcaption (a) (temp2);
                                    path[line width=0.03cm] (temp1) edge node (left_i);
                                    path[line width=0.03cm] (temp2) edge node (right_i);
                                    endtikzpicture
                                    captionsetup[subfigure]width=0.8textwidth
                                    %subcaptionsmall Subcaption (a)
                                    labelsubfig:Event1
                                    endminipage%
                                    beginminipage0.320textwidth
                                    centering
                                    begintikzpicture
                                    tikzstylemain=[circle, minimum size = 5.5mm, thick, draw =black!80, node distance = 3mm]
                                    tikzstyleconnect=[-latex, thick]
                                    node[main] (i) small $i$;
                                    node[main] (above_i) [above left=of i] ;
                                    node[main] (left_i) [left=of i] ;
                                    node[main,fill=black!30] (right_i) [right=of i] ;
                                    node[main] (right_above_i) [above right=of i, above left=of right_i] ;
                                    node[main] (temp1) [below=of left_i] ;
                                    node[main] (temp2) [below=of right_i] ;
                                    path[line width=0.03cm] (i) edge node (above_i);
                                    path[line width=0.03cm] (i) edge node (left_i);
                                    path[line width=0.03cm] (i) edge node (right_i);
                                    path[line width=0.03cm] (above_i) edge node (left_i);
                                    path[line width=0.03cm] (right_i) edge node (right_above_i);
                                    path[line width=0.03cm] (i) edge node (right_above_i);
                                    path[line width=0.03cm] (temp1) edge node[shift=(.1,-.7),font=small] Subcaption (b) (temp2);
                                    path[line width=0.03cm] (temp1) edge node (left_i);
                                    path[line width=0.03cm] (temp2) edge node (right_i);

                                    endtikzpicture
                                    captionsetup[subfigure]width=0.8textwidth
                                    %subcaptionsmall Subcaption (b)
                                    labelsubfig:Event2
                                    endminipage%
                                    beginminipage0.320textwidth
                                    centering
                                    begintikzpicture
                                    tikzstylemain=[circle, minimum size = 5.5mm, thick, draw =black!80, node distance = 3mm]
                                    tikzstyleconnect=[-latex, thick]
                                    node[main] (i) small $i$;
                                    node[main] (above_i) [above left=of i] ;
                                    node[main,fill=black!30] (left_i) [left=of i] ;
                                    node[main] (right_i) [right=of i] ;
                                    node[main] (right_above_i) [above right=of i, above left=of right_i] ;
                                    node[main] (temp1) [below=of left_i] ;
                                    node[main] (temp2) [below=of right_i] ;
                                    path[line width=0.03cm] (i) edge node (above_i);
                                    path[line width=0.03cm] (i) edge node (left_i);
                                    path[line width=0.03cm] (i) edge node (right_i);
                                    path[line width=0.03cm] (above_i) edge node (left_i);
                                    path[line width=0.03cm] (right_i) edge node (right_above_i);
                                    path[line width=0.03cm] (i) edge node (right_above_i);
                                    path[line width=0.03cm] (temp1) edge node[midway,shift=(.1,-.7),font=small]Subcaption (c) (temp2);
                                    path[line width=0.03cm] (temp1) edge node (left_i);
                                    path[line width=0.03cm] (temp2) edge node (right_i);
                                    endtikzpicture
                                    captionsetup[subfigure]width=0.8textwidth
                                    %subcaptionsmall Subcaption (c)
                                    labelsubfig:Event3
                                    endminipage
                                    vspace-0.2cm
                                    captionsetupwidth=0.98textwidth
                                    captionsmall Caption
                                    labelfig:threeEvents
                                    vspace-0.2cm
                                    endfigure

                                    sectionConclusion
                                    We build a linear regression model to predict the next value of each instrument.

                                    enddocument





                                    share|improve this answer












                                    It is possible to write the text with tikz below each figure. To do this, simply place this text in the node below the edge that joins the two lower circles:



                                     path[line width=0.03cm] (temp1) edge node[shift=(.1,-.7),font=small] Subcaption (b) (temp2);


                                    caption



                                    documentclass[preprint,12pt]article

                                    usepackageamsmath

                                    usepackagesubfig
                                    usepackagecaption
                                    %usepackagesubcaption
                                    usepackagetikz
                                    usetikzlibraryfit,positioning,arrows,automata,calc

                                    usepackagelineno

                                    begindocument
                                    beginfigure[!thb]
                                    beginminipage0.320textwidth
                                    centering
                                    begintikzpicture
                                    tikzstylemain=[circle, minimum size = 5.5mm, thick, draw =black!80, node distance = 3mm]
                                    tikzstyleconnect=[-latex, thick]
                                    node[main,fill=black!30] (i) small $i$;
                                    node[main] (above_i) [above left=of i] ;
                                    node[main] (left_i) [left=of i] ;
                                    node[main] (right_i) [right=of i] ;
                                    node[main] (right_above_i) [above right=of i, above left=of right_i] ;
                                    node[main] (temp1) [below=of left_i] ;
                                    node[main] (temp2) [below=of right_i] ;
                                    path[line width=0.03cm] (i) edge node (above_i);
                                    path[line width=0.03cm] (i) edge node (left_i);
                                    path[line width=0.03cm] (i) edge node (right_i);
                                    path[line width=0.03cm] (above_i) edge node (left_i);
                                    path[line width=0.03cm] (right_i) edge node (right_above_i);
                                    path[line width=0.03cm] (i) edge node (right_above_i);
                                    path[line width=0.03cm] (temp1) edge node[shift=(0,-.7),font=small] Subcaption (a) (temp2);
                                    path[line width=0.03cm] (temp1) edge node (left_i);
                                    path[line width=0.03cm] (temp2) edge node (right_i);
                                    endtikzpicture
                                    captionsetup[subfigure]width=0.8textwidth
                                    %subcaptionsmall Subcaption (a)
                                    labelsubfig:Event1
                                    endminipage%
                                    beginminipage0.320textwidth
                                    centering
                                    begintikzpicture
                                    tikzstylemain=[circle, minimum size = 5.5mm, thick, draw =black!80, node distance = 3mm]
                                    tikzstyleconnect=[-latex, thick]
                                    node[main] (i) small $i$;
                                    node[main] (above_i) [above left=of i] ;
                                    node[main] (left_i) [left=of i] ;
                                    node[main,fill=black!30] (right_i) [right=of i] ;
                                    node[main] (right_above_i) [above right=of i, above left=of right_i] ;
                                    node[main] (temp1) [below=of left_i] ;
                                    node[main] (temp2) [below=of right_i] ;
                                    path[line width=0.03cm] (i) edge node (above_i);
                                    path[line width=0.03cm] (i) edge node (left_i);
                                    path[line width=0.03cm] (i) edge node (right_i);
                                    path[line width=0.03cm] (above_i) edge node (left_i);
                                    path[line width=0.03cm] (right_i) edge node (right_above_i);
                                    path[line width=0.03cm] (i) edge node (right_above_i);
                                    path[line width=0.03cm] (temp1) edge node[shift=(.1,-.7),font=small] Subcaption (b) (temp2);
                                    path[line width=0.03cm] (temp1) edge node (left_i);
                                    path[line width=0.03cm] (temp2) edge node (right_i);

                                    endtikzpicture
                                    captionsetup[subfigure]width=0.8textwidth
                                    %subcaptionsmall Subcaption (b)
                                    labelsubfig:Event2
                                    endminipage%
                                    beginminipage0.320textwidth
                                    centering
                                    begintikzpicture
                                    tikzstylemain=[circle, minimum size = 5.5mm, thick, draw =black!80, node distance = 3mm]
                                    tikzstyleconnect=[-latex, thick]
                                    node[main] (i) small $i$;
                                    node[main] (above_i) [above left=of i] ;
                                    node[main,fill=black!30] (left_i) [left=of i] ;
                                    node[main] (right_i) [right=of i] ;
                                    node[main] (right_above_i) [above right=of i, above left=of right_i] ;
                                    node[main] (temp1) [below=of left_i] ;
                                    node[main] (temp2) [below=of right_i] ;
                                    path[line width=0.03cm] (i) edge node (above_i);
                                    path[line width=0.03cm] (i) edge node (left_i);
                                    path[line width=0.03cm] (i) edge node (right_i);
                                    path[line width=0.03cm] (above_i) edge node (left_i);
                                    path[line width=0.03cm] (right_i) edge node (right_above_i);
                                    path[line width=0.03cm] (i) edge node (right_above_i);
                                    path[line width=0.03cm] (temp1) edge node[midway,shift=(.1,-.7),font=small]Subcaption (c) (temp2);
                                    path[line width=0.03cm] (temp1) edge node (left_i);
                                    path[line width=0.03cm] (temp2) edge node (right_i);
                                    endtikzpicture
                                    captionsetup[subfigure]width=0.8textwidth
                                    %subcaptionsmall Subcaption (c)
                                    labelsubfig:Event3
                                    endminipage
                                    vspace-0.2cm
                                    captionsetupwidth=0.98textwidth
                                    captionsmall Caption
                                    labelfig:threeEvents
                                    vspace-0.2cm
                                    endfigure

                                    sectionConclusion
                                    We build a linear regression model to predict the next value of each instrument.

                                    enddocument






                                    share|improve this answer












                                    share|improve this answer



                                    share|improve this answer










                                    answered 18 mins ago









                                    AndréC

                                    4,5621834




                                    4,5621834



























                                         

                                        draft saved


                                        draft discarded















































                                         


                                        draft saved


                                        draft discarded














                                        StackExchange.ready(
                                        function ()
                                        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f457283%2fhow-to-add-subcaption-to-tikz%23new-answer', 'question_page');

                                        );

                                        Post as a guest













































































                                        Comments

                                        Popular posts from this blog

                                        What does second last employer means? [closed]

                                        List of Gilmore Girls characters

                                        Confectionery