在两点之间画直线

在两点之间画直线

在此处输入图片描述 我怎样才能用乳胶制作这个图表,

答案1

纯粹的蒂克兹并使用稍微自动化的方法来制作:

在此处输入图片描述

我使用了@marmot 的漂亮bullet风格:

\documentclass{article}
\usepackage{tikz}
\begin{document}

  \begin{tikzpicture}[bullet/.style={circle,fill,inner sep=1pt}]
     % A=start of line, B=end of line, pts=x-coords of bullets
     % scale the line spacing by 0.7: y = -0.7\c
     \foreach \A/\B/\pts/\txt [count=\c, 
           evaluate=\c as \y using {-\c*0.7}] in {
        1/5/{3}/{is left-dense and right-dense},
        1/3/{3,4}/{is left-dense and right-scattered},
        3/5/{2,3}/{is left-scattered and right-dense},
        0/0/{2,3,4}/{is left-scattered and right-scattered}
        } {
           \ifnum\A>0 \draw(\A,\y)--(\B,\y);\fi
           \draw (3,\y+0.1) -- ++(0,-0.2)node[below]{$t_\c$};
           \foreach \pt in \pts {
              \node[bullet] at (\pt,\y){};
           }
           \node[right,anchor=west] at (5,\y){$t_\c$ \txt};
    }
    \node[right,anchor=west] at (5,-5*0.7)
        {($t_1$ is left-dense and $t_4$ is isolated)};
  \end{tikzpicture}

\end{document}

答案2

不适合评论。也许有点微妙的一点是baseline

\documentclass{article}
\usepackage{tikz}
\tikzset{bullet/.style={circle,fill,inner sep=1pt}}
\begin{document}
\begin{tabular}{ll}
\begin{tikzpicture}[baseline=0pt]
\draw[-] (-2,0) -- (2,0)  (0,0.1) -- (0,-0.1)node[midway,bullet]{}
node[below]{$t_1$}; 
\end{tikzpicture}
& $t_1$ is left--dense and right--dense\\
\begin{tikzpicture}[baseline=0pt]
\draw[-] (-2,0) -- (0,0)  (0,0.1) -- (0,-0.1)node[midway,bullet]{}
node[below]{$t_2$} (1,0)node[bullet]{}; 
\end{tikzpicture}
& $t_2$ is \dots\\
\begin{tikzpicture}[baseline=0pt]
\draw[-] (2,0) -- (0,0)  (0,0.1) -- (0,-0.1)node[midway,bullet]{}
node[below]{$t_3$} (-1,0)node[bullet]{}; \path(-2,0);
\end{tikzpicture}
& $t_3$ is \dots\\
\begin{tikzpicture}[baseline=0pt]
\draw[-]   (0,0.1) -- (0,-0.1)node[midway,bullet]{}
node[below]{$t_4$} (-1,0)node[bullet]{} (1,0)node[bullet]{}; \path(-2,0);
\end{tikzpicture}
& $t_4$ is \dots\\
& (\dots) \\
\end{tabular}
\end{document}

在此处输入图片描述

相关内容