我想绘制一些如下所示的标签的图形表示:
我正在使用的工作如下:
\begin{figure}[h!]
\centering
\begin{tikzpicture}
\centering
\coordinate (0) at (0,0);
\coordinate (A) at (4,0);
\coordinate (B) at (0,-2);
\coordinate (C) at (4,-2);
\coordinate (E) at (1.5,1);
\coordinate (F) at (5.5,1);
\coordinate (G) at (1.5,-1);
\coordinate (H) at (5.5,-1);
\coordinate (I) at (1.5,-0.8);
\draw (0) node[left]{$MI$};
\draw (E) node[above]{$MC$};
\draw (F) node[above]{$TM$};
\draw (B) node[left]{$BMI$};
\draw (C) node[below]{$FMI$};
\draw (H) node[right]{$FM$};
\draw (I) node[left]{$BM$};
\draw [fill=black] (0) circle (2pt);
\draw [fill=black] (A) circle (2pt);
\draw [fill=black] (B) circle (2pt);
\draw [fill=black] (C) circle (2pt);
\draw [fill=black] (E) circle (2pt);
\draw [fill=black] (F) circle (2pt);
\draw [fill=black] (G) circle (2pt);
\draw [fill=black] (H) circle (2pt);
\draw (0) -- (A) -- (C) -- (B) -- (0) -- (E);
\draw (E) -- (F) -- (H) -- (G) -- (E);
\draw (A) -- (F);
\draw (C) -- (H);
\draw (B) -- (G);
\end{tikzpicture}
\caption{Graph Representation of $FTTM$ version 1 and $FTTM$ version 2}
\label{figure:graph-representation}
\end{figure}
产生:
谁能帮忙。
答案1
pic
这是使用重复方案的建议。
\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{tikzpicture}[bullet/.style={circle,fill,inner sep=1.5pt,},
pics/A-graph/.style={code={
\draw (-2,0) node[bullet,label={above left:$A_2^{#1}$}] (A-#1-2){}
-- (-1,1) node[bullet,label={above right:$A_1^{#1}$}] (A-#1-1){}
-- (1,1) node[bullet,label={above left:$A_n^{#1}$}] (A-#1-n){}
-- (2,0) node[bullet,label={above right:$A_{n-1}^{#1}$}] (A-#1-m){};
\draw[densely dotted] (A-#1-2) to[out=-90,in=-90] (A-#1-m);
\draw[blue!80,line width=3pt,-{Stealth[width=7pt,length=5pt]}]
(2.1,-0.5) -- (2.6,-0.5)node[black,right]{$FTTM_n^{#1}$};
}}]
\path (60:5.5) pic{A-graph=1} (60:4) pic{A-graph=2}
(60:2) pic{A-graph=j} (0,0) pic{A-graph=k};
\foreach \X in {2,1,n,m}
{\draw plot[samples at={1,2,j,k}] (A-\x-\X);}
\end{tikzpicture}
\end{document}
或者,为了解决评论中的问题,可以使用键来实现虚线dashed
。
\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{tikzpicture}[bullet/.style={circle,fill,inner sep=1.5pt,},
pics/A-graph/.style={code={
\draw (-2,0) node[bullet,label={above left:$A_2^{#1}$}] (A-#1-2){}
-- (-1,1) node[bullet,label={above:$A_1^{#1}$}] (A-#1-1){}
-- (1,1) node[bullet,label={above:$A_n^{#1}$}] (A-#1-n){}
-- (2,0) node[bullet,label={above right:$A_{n-1}^{#1}$}] (A-#1-m){};
\draw[densely dotted] (A-#1-2) to[out=-90,in=-90] (A-#1-m);
\draw[blue!80,line width=3pt,-{Stealth[width=7pt,length=5pt]}]
(2.1,-0.5) -- (2.6,-0.5)node[black,right]{$FTTM_n^{#1}$};
}}]
\path (75:5.5) pic{A-graph=1} (75:4) pic{A-graph=2}
(75:2) pic{A-graph=j} (0,0) pic{A-graph=k};
\foreach \X in {2,1,n,m}
{\draw[dashed] plot[samples at={1,k}] (A-\x-\X);}
\end{tikzpicture}
\end{document}