2

enter image description here

I want to know if there are any better methods? Especially I will draw many SEMs and they are different. How to label these curved arrows conveniently use those numbers? Why don't the arrows link toghether with the ellipse?

 \documentclass[tikz,border=2mm]{standalone}
\usetikzlibrary{arrows,calc}
\begin{document}
\begin{tikzpicture}[scale=0.4]
%draw circles
\foreach \i in {1,...,33}
\draw (\i,10.5) circle [radius=0.3];
%draw rectangles
\foreach \i in {1,...,33}
\draw (\i-0.4,9) rectangle (\i+0.4,9.4);
%draw ellipses
\draw (3,6) ellipse (1 and 0.6);
\draw (8.5,6) ellipse (1 and 0.6);
\draw (14,6) ellipse (1 and 0.6);
\draw (19.5,6) ellipse (1 and 0.6);
\draw (25,6) ellipse (1 and 0.6);
\draw (30.5,6) ellipse (1 and 0.6);
% draw arrows
\foreach \i in {1,...,33}
\draw [-latex] (\i,10.2) -- (\i,9.4);
\foreach \i in {1,...,5}
\draw [-latex] (3,6.6) -- (\i,9);
\foreach \i in {6,...,11}
\draw [-latex] (8.5,6.6) -- (\i,9);
\foreach \i in {12,...,16}
\draw [-latex] (14,6.6) -- (\i,9);
\foreach \i in {17,...,22}
\draw [-latex] (19.5,6.6) -- (\i,9);
\foreach \i in {23,...,27}
\draw [-latex] (25,6.6) -- (\i,9);
\foreach \i in {28,...,33}
\draw [-latex] (30.5,6.6) -- (\i,9);
\node (a) at (3,5.4) {};
\node (b) at (8.5,5.4) {};
\node (c) at (14,5.4) {};
\node (d) at (19.5,5.4) {};
\node (e) at (25,5.4) {};
\node (f) at (30.5,5.4) {};
%\draw[<->,-latex] (a) -- (b);
\draw[<->,bend right]  (a) edge (b);
\draw[<->,bend right]  (b) edge (c);
\draw[<->,bend right]  (c) edge (d);
\draw[<->,bend right]  (d) edge (e);
\draw[<->,bend right]  (e) edge (f);
\draw[<->,bend right]  (a) edge (c);
\draw[<->,bend right]  (a) edge (d);
\draw[<->,bend right]  (a) edge (e);
\draw[<->,bend right]  (a) edge (f);
\draw[<->,bend right]  (b) edge (c);
\draw[<->,bend right]  (b) edge (d);
\draw[<->,bend right]  (b) edge (e);
\draw[<->,bend right]  (b) edge (f);
\draw[<->,bend right]  (c) edge (d);
\draw[<->,bend right]  (c) edge (e);
\draw[<->,bend right]  (c) edge (f);
\draw[<->,bend right]  (d) edge (e);
\draw[<->,bend right]  (d) edge (f);
\draw[<->,bend right]  (e) edge (f);
\end{tikzpicture}
   \end{document} 

enter image description here

  • Welcome to TeX.SX! Questions of the form "Please draw this for me", which show no effort on the part of OP, often don't get answered. You will get more help if you post some code showing what you have tried and give a minimal working example. A quick search on TeX.SX for drawing functions (with tikz or pstricks) will give you an idea of where to start from. – Andrew Nov 29 '17 at 11:48
  • Thank you. I just want to know if someone have done this work and I will try to give a minimal working example. – dozer Nov 29 '17 at 11:53
2

Compile with LuaLaTeX:

\RequirePackage{luatex85}
\documentclass[tikz,border=5]{standalone}
\usetikzlibrary{graphs,graphdrawing,arrows.meta,quotes,shapes.geometric}
\usegdlibrary{layered,trees}
\begin{document}
\begin{tikzpicture}[>=Stealth]
\graph [tree layout,
  edge quotes mid, edge quotes={
    fill=white, font=\tiny, shape=circle, inner sep=0
  }, 
  sibling distance=0.1cm, sibling sep=0.1cm, component sep=0.1cm,
  level 1/.style={nodes={ellipse, draw}},
  level 2/.style={nodes={rectangle, draw, font=\tiny}},
  level 3/.style={nodes={circle, draw, inner sep=0.05cm}, target edge style={<-}},
  level distance=1.5cm, 
  grow=up
]
{
  F1 ->[".81"] q1 -> e1;
  F1 ->[".83"] q2 -> e2;
  F1 ->[".81"] q3 -> e3;
  F1 ->[".71"] q4 -> e4;
  F1 ->[".74"] q5 -> e5;
  %
  F2 ->[".80"] q6  -> e6;
  F2 ->[".82"] q7  -> e7;
  F2 ->[".82"] q8  -> e8;
  F2 ->[".80"] q9  -> e9;
  F2 ->[".78"] q10 -> e10;
  F2 ->[".82"] q11  -> e11;
  %
  F3 ->[".88"] q12 -> e12;
  F3 ->[".82"] q13 -> e13;
  F3 ->[".83"] q14 -> e14;
  F3 ->[".84"] q15 -> e15;
  F3 ->[".88"] q16 -> e16;
  %
  F4 ->[".85"] q17 -> e17;
  F4 ->[".88"] q18 -> e18;
  F4 ->[".85"] q19 -> e19;
  F4 ->[".77"] q20 -> e20;
  F4 ->[".76"] q21 -> e21;
  F4 ->[".63"] q22 -> e22;
  %
  F5 ->[".85"] q23 -> e23;
  F5 ->[".88"] q24 -> e24;
  F5 ->[".85"] q25 -> e25;
  F5 ->[".77"] q26 -> e26;
  F5 ->[".76"] q27 -> e27;
  %
  F6 ->[".85"] q28 -> e28;
  F6 ->[".88"] q29 -> e29;
  F6 ->[".85"] q30 -> e30;
  F6 ->[".77"] q31 -> e31;
  F6 ->[".76"] q32 -> e32;
  F6 ->[".63"] q33 -> e33;
};
\graph [edge quotes={font=\small, above=0.125cm, inner sep=0},
   edges={out=300, in=240}]{
  (F1) <->[".70"] (F2);
  (F1) <->[".72"] (F3);
  (F1) <->[".74"] (F4);
  (F1) <->[".76"] (F5);
  (F1) <->[".78"] (F6);
  (F2) <->[".80"] (F3);
  (F2) <->[".82"] (F4);
  (F2) <->[".84"] (F5);
  (F2) <->[".86"] (F6);
  (F3) <->[".90"] (F4);
  (F3) <->[".92"] (F5);
  (F3) <->[".94"] (F6);
  (F4) <->[".10"] (F5);
  (F4) <->[".12"] (F6);
  (F5) <->[".20"] (F6);
};
\end{tikzpicture}
\end{document}

enter image description here

  • how to decrease the length of arrows of the third level(between e1 and q1) – dozer Dec 6 '17 at 14:52
  • @dozer add (e.g.) level distance=0.5cm to the level 2 style – Mark Wibrow Dec 6 '17 at 15:03
  • Can we rotate the model 90 degree clockwise or counterclockwise – dozer Dec 8 '17 at 2:23
2

This kind of flowchart may be a good opportunity to use this tikz graphical editor.

It is described as:

A simple visual editor for creating commutative diagrams.

You can host your own instance by following the install steps on the GitHub repo or you can try it online.

Once you are happy with your diagram, you can copy the code and paste it in your LaTeX document. The generated code works with the tikz-cd package :

\documentclass{article}

\usepackage{tikz-cd}

\begin{document}

%% paste the generated code here.

\end{document}
2

enter image description here

\documentclass[tikz,border=2mm]{standalone}
\usetikzlibrary{arrows,calc}
\usepackage{anyfontsize}
\newcommand{\jiuhao}{\fontsize{2.55pt}{\baselineskip}\selectfont}
\newcommand{\shihao}{\fontsize{1.2pt}{\baselineskip}\selectfont}
\begin{document}
\begin{tikzpicture}[scale=0.4]
%draw circles
\foreach \i in {1,...,33}
\draw (\i,10.5) circle [radius=0.3] node[font=\jiuhao] {e{\i}};
%draw rectangles
\foreach \i in {1,...,33}
\draw (\i-0.4,9) rectangle (\i+0.4,9.4) ;
\foreach \i in {1,...,33}
\node at (\i,9.2)[font=\jiuhao]{q{\i}};
%draw ellipses
\draw (3,6) ellipse (1 and 0.6);
\draw (8.5,6) ellipse (1 and 0.6);
\draw (14,6) ellipse (1 and 0.6);
\draw (19.5,6) ellipse (1 and 0.6);
\draw (25,6) ellipse (1 and 0.6);
\draw (30.5,6) ellipse (1 and 0.6);
% draw arrows
\foreach \i in {1,...,33}
\draw [-latex] (\i,10.2) -- (\i,9.4);
%\foreach \i in {1,...,5}
%\draw [-latex] (3,6.6) -- (\i,9);
\draw [-latex] (3,6.6) to node[fill=white, font=\shihao]{.88} (1,9);
\draw [-latex] (3,6.6)  to node[fill=white,font=\shihao]{.88} (2,9) ;
\draw [-latex] (3,6.6)  to node[fill=white,font=\shihao]{.88} (3,9) ;
\draw [-latex] (3,6.6)  to node[fill=white,font=\shihao]{.88} (4,9) ;
\draw [-latex] (3,6.6)  to node[fill=white,font=\shihao]{.88} (5,9);
\foreach \i in {6,...,11}
%\draw [-latex] (8.5,6.6) -- (\i,9);
\draw [-latex] (8.5,6.6) to node[fill=white, font=\shihao]{.88} (6,9);
\draw [-latex] (8.5,6.6)  to node[fill=white,font=\shihao]{.88} (7,9) ;
\draw [-latex] (8.5,6.6)  to node[fill=white,font=\shihao]{.88} (8,9) ;
\draw [-latex] (8.5,6.6)  to node[fill=white,font=\shihao]{.88} (9,9) ;
\draw [-latex] (8.5,6.6)  to node[fill=white,font=\shihao]{.88} (10,9);
\draw [-latex] (8.5,6.6)  to node[fill=white,font=\shihao]{.88} (11,9);
\foreach \i in {12,...,16}
%\draw [-latex] (14,6.6) -- (\i,9);
\draw [-latex] (14,6.6) to node[fill=white, font=\shihao]{.88} (12,9);
\draw [-latex] (14,6.6)  to node[fill=white,font=\shihao]{.88} (13,9) ;
\draw [-latex] (14,6.6)  to node[fill=white,font=\shihao]{.88} (14,9) ;
\draw [-latex] (14,6.6)  to node[fill=white,font=\shihao]{.88} (15,9) ;
\draw [-latex] (14,6.6)  to node[fill=white,font=\shihao]{.88} (16,9);
\foreach \i in {17,...,22}
%\draw [-latex] (19.5,6.6) -- (\i,9);
\draw [-latex] (19.5,6.6) to node[fill=white, font=\shihao]{.88} (17,9);
\draw [-latex] (19.5,6.6)  to node[fill=white,font=\shihao]{.88} (18,9) ;
\draw [-latex] (19.5,6.6)  to node[fill=white,font=\shihao]{.88} (19,9) ;
\draw [-latex] (19.5,6.6)  to node[fill=white,font=\shihao]{.88} (20,9) ;
\draw [-latex] (19.5,6.6)  to node[fill=white,font=\shihao]{.88} (21,9);
\draw [-latex] (19.5,6.6)  to node[fill=white,font=\shihao]{.88} (22,9);
\foreach \i in {23,...,27}
%\draw [-latex] (25,6.6) -- (\i,9);
\draw [-latex] (25,6.6) to node[fill=white, font=\shihao]{.88} (23,9);
\draw [-latex] (25,6.6)  to node[fill=white,font=\shihao]{.88} (24,9) ;
\draw [-latex] (25,6.6)  to node[fill=white,font=\shihao]{.88} (25,9) ;
\draw [-latex] (25,6.6)  to node[fill=white,font=\shihao]{.88} (26,9) ;
\draw [-latex] (25,6.6)  to node[fill=white,font=\shihao]{.88} (27,9);
\foreach \i in {28,...,33}
%\draw [-latex] (30.5,6.6) -- (\i,9);
\draw [-latex] (30.5,6.6) to node[fill=white, font=\shihao]{.88} (28,9);
\draw [-latex] (30.5,6.6)  to node[fill=white,font=\shihao]{.88} (29,9) ;
\draw [-latex] (30.5,6.6)  to node[fill=white,font=\shihao]{.88} (30,9) ;
\draw [-latex] (30.5,6.6)  to node[fill=white,font=\shihao]{.88} (31,9) ;
\draw [-latex] (30.5,6.6)  to node[fill=white,font=\shihao]{.88} (32,9);
\draw [-latex] (30.5,6.6)  to node[fill=white,font=\shihao]{.88} (33,9);
\node[above] (a) at (3,5.4) {F1};
\node[above] (b) at (8.5,5.4) {F2};
\node [above](c) at (14,5.4) {F3};
\node [above](d) at (19.5,5.4) {F4};
\node[above] (e) at (25,5.4) {F5};
\node[above] (f) at (30.5,5.4) {F6};
%\draw[<->,-latex] (a) -- (b);
\draw[<->,>=latex,bend right]  (a) to node[fill=white,font=\jiuhao] {.88} (b) ;
\draw[<->,>=latex,bend right]  (b) to node[fill=white,font=\jiuhao] {.88} (c);
\draw[<->,>=latex,bend right]  (c) to node[fill=white,font=\jiuhao] {.88} (d);
\draw[<->,>=latex,bend right]  (d) to node[fill=white,font=\jiuhao] {.88} (e);
\draw[<->,>=latex,bend right]  (e) to node[fill=white,font=\jiuhao] {.88} (f);
\draw[<->,>=latex,bend right]  (a) to node[fill=white,font=\jiuhao] {.88} (c);
\draw[<->,>=latex,bend right]  (a) to node[fill=white,font=\jiuhao] {.88} (d);
\draw[<->,>=latex,bend right]  (a) to node[fill=white,font=\jiuhao] {.88} (e);
\draw[<->,>=latex,bend right]  (a) to node[fill=white,font=\jiuhao] {.88} (f);
\draw[<->,>=latex,bend right]  (b) to node[fill=white,font=\jiuhao] {.88} (d);
\draw[<->,>=latex,bend right]  (b) to node[fill=white,font=\jiuhao] {.88} (e);
\draw[<->,>=latex,bend right]  (b) to node[fill=white,font=\jiuhao] {.88} (f);
\draw[<->,>=latex,bend right]  (c) to node[fill=white,font=\jiuhao] {.88} (e);
\draw[<->,>=latex,bend right]  (c) to node[fill=white,font=\jiuhao] {.88} (f);
\draw[<->,>=latex,bend right]  (d) to node[fill=white,font=\jiuhao] {.88} (f);
\end{tikzpicture}
   \end{document} 
  • welcome better methods. – dozer Dec 5 '17 at 6:46
  • I want to resize the label box, I hope the label box become smaller and the font become larger. – dozer Dec 5 '17 at 6:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.