这可能很容易学习,但对我来说有点紧急。因此,如果有人有一些 latex 中的示例代码可以分享或记录,请轻松解释如何获得类似的东西http://en.wikipedia.org/wiki/File:Discrete_probability_distribution_illustration.svg太棒了。非常感谢!
答案1
由于情况紧急,所以这是一份速成草稿,没有解释。欢迎随时询问。
\documentclass{article}
\usepackage{tikz}
\begin{document}
\tikzset{
open/.style = {circle, minimum size=2mm,draw, fill=white,inner sep=0pt},
closed/.style = {circle, minimum size=2mm, fill, inner sep=0pt},
}
\begin{tikzpicture}[thick]
\draw[blue] (0,0) -- +(4,0) node[pos=0,left] {\tt\color{black} 1};
\draw[blue] (0,-1) -- +(4,0) node[pos=0,left] {\tt\color{black} 0};
\draw[red] (0,-1) -- (.6,-1) node[open] {};
\draw[red] (.6,-.75) node[closed] {} -- (1.6,-.75) node[open] {};
\draw[red] (1.6,-.4) node[closed] {} -- (3,-.4) node[open] {};
\draw[red] (3,0) node[closed] {} -- (4,0);
\end{tikzpicture}
\begin{tikzpicture}[thick]
\draw[blue] (0,0) -- +(4,0) node[pos=0,left] {\tt\color{black} 1};
\draw[blue] (0,-1) -- +(4,0) node[pos=0,left] {\tt\color{black} 0};
\draw[red] (0,-1) -- (1,-1) to[out=0,in=180] (3,0) -- (4,0);
\end{tikzpicture}
\begin{tikzpicture}[thick]
\draw[blue] (0,0) -- +(4,0) node[pos=0,left] {\tt\color{black} 1};
\draw[blue] (0,-1) -- +(4,0) node[pos=0,left] {\tt\color{black} 0};
\draw[red] (0,-1) -- (.3,-1) to[out=0, in=190] (1,-.9) node[open] {};
\draw[red] (1, -.6) node[closed] {} to[out=10,in=180] (3,0) -- (4,0);
\end{tikzpicture}
\end{document}
结果: