对于下面的代码,标签位于每个弧的底部,我需要它们位于中心。
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{shapes,positioning}
\begin{document}
\tikzset{ell/.style={ellipse,draw,minimum height=0.15cm,minimum width=0.2cm,inner sep=0.1cm}}
\begin{figure}[t]
\begin{center}
\begin{tikzpicture}[>=stealth]
\node[ell] (e1)at (-3,0) {\color{blue}$1$};
\node[ell] (e2)at (3,0) {\color{blue}$2$};
\draw (-2,-1)--(-1,-1.5)--(-1.5,-2)--cycle;
\draw (2,-1)--(1.5,-2)--(1,-1.5)--cycle;
\node[ell] (e6)at (0,-3) {\color{blue}$6$};
\draw[<-](e1)--(-2,-1) node[left]{\color{red} \tiny $y_{11}$};
\draw[<-](e2)--(2,-1) node[right]{\color{red} \tiny $y_{21}$};
\draw[<-](-1.25,-1.75)--(e6) node[left]{\color{red} \tiny $y_{12}$};
\draw[<-](1.25,-1.75)--(e6) node[right]{\color{red} \tiny $y_{22}$};
\end{tikzpicture}
\end{center}
\end{figure}
\end{document}
答案1
这就是你想要的吗?我对三角形的背景和含义很好奇。其中的小数(1.25,-1.75)
似乎不自然。
\documentclass[border=5mm]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[>=stealth]
\path[nodes={circle,draw,text=blue}]
(-3,0) node (e1) {$1$}
(3,0) node (e2) {$2$}
(0,-3) node (e6) {$6$}
;
\draw
(-2,-1)--(-1,-1.5)--(-1.5,-2)--cycle;
(2,-1)--(1.5,-2)--(1,-1.5)--cycle;
\begin{scope}[nodes={midway,red,scale=.7}]
\draw[<-] (e1)--(-2,-1) node[below left]{$y_{11}$};
\draw[<-] (e2)--(2,-1) node[below right]{$y_{21}$};
\draw[<-] (-1.25,-1.75)--(e6) node[below left]{$y_{12}$};
\draw[<-] (1.25,-1.75)--(e6) node[below right]{$y_{22}$};
\end{scope}
\end{tikzpicture}
\end{document}