-1

This question already has an answer here:

enter image description here How can I make this graph by latex,

marked as duplicate by Henri Menke tikz-pgf May 16 at 6:10

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 6
    this can be done by basic tikz package instruction. do you read its documentation? at list one of its tutorials? what you try so far? welcome to tex.se! – Zarko May 15 at 13:46
2

A purely tikz and slightly automated approach to produce:

enter image description here

I have used @marmot's nice bullet style:

\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}
  • Thank you so much – Nour May 15 at 18:58
3

Doesn't fit into a comment. A perhaps somewhat subtle point is the 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}

enter image description here

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