我们可以使用 tikz 绘制 SEM 吗?

我们可以使用 tikz 绘制 SEM 吗?

在此处输入图片描述

我想知道有没有更好的方法?特别是我会画很多SEM,而且它们都不一样。如何方便地用那些数字来标记这些弯曲的箭头?为什么箭头不与椭圆连在一起?

 \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} 

在此处输入图片描述

答案1

编译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}

在此处输入图片描述

答案2

这种流程图可能是一个很好的机会来利用这一点tikz 图形编辑器

其描述如下:

一个用于创建交换图的简单的可视化编辑器。

您可以按照 GitHub repo 上的安装步骤托管自己的实例,也可以在线试用

对图表满意后,您可以复制代码并将其粘贴到 LaTeX 文档中。生成的代码可与以下tikz-cd包配合使用:

\documentclass{article}

\usepackage{tikz-cd}

\begin{document}

%% paste the generated code here.

\end{document}

答案3

在此处输入图片描述

\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} 

相关内容