1

The graph is not working as intended and I am getting the following error code: ! Package pgfkeys Error: I do not know the key '/tikz/discontinuous' and I am going to ignore it. Perhaps you misspelled it.See the pgfkeys package documentation for explanation.Type H for immediate help.... \end{axis}

My code is below.

\documentclass[]{article}

\usepackage{pgfplotstable}
\usepackage{pgfplots}

\begin{document} 
The C.D.F is as follows:

\[F(x)=
\begin{dcases}
0&\text{$x<1$}\\
\frac{11}{36}&\text{$1\leq x<2$}\\
\frac{20}{36}&\text{$2\leq x<3$}\\
\frac{27}{36}&\text{$3\leq x<4$}\\
\frac{32}{36}&\text{$4\leq x<5$}\\
\frac{35}{36}&\text{$5\leq x<6$}\\
1&\text{$x\geq 6$}\\
\end{dcases}
\]

The C.D.F can be graphed as follows:

{\centering
\begin{tikzpicture}
\begin{axis}[
clip=false,
jump mark left,
ymin=0,ymax=1,
xmin=0, xmax=5,
every axis plot/.style={very thick},
discontinuous,
table/create on use/cumulative distribution/.style={
    create col/expr={\pgfmathaccuma + \thisrow{f(x)}}   
}
]
\addplot [red] table [y=cumulative distribution]{
x f(x)
0 0
1 11/36
2 20/36
3 27/36
4 32/36
5 35/36
6 1
};
\end{axis}
\end{tikzpicture}
\par}
\end{document}

1 Answers1

3

Just spelling out what Henri Menke said. I will be happy to remove this answer. Note that there are several things you may consider changing, such as the use of a figure. I removed, as suggested by Henri Menke, discontinuous, which is not a standard style, as well as xmin, xmax, ymin and ymax.

\documentclass[]{article}
\usepackage{amsmath,mathtools}
\usepackage{pgfplotstable}
\usepackage{pgfplots}

\begin{document} 
The C.D.F is as follows:
\[F(x)=
\begin{dcases}
0&\text{$x<1$}\\
\frac{11}{36}&\text{$1\leq x<2$}\\
\frac{20}{36}&\text{$2\leq x<3$}\\
\frac{27}{36}&\text{$3\leq x<4$}\\
\frac{32}{36}&\text{$4\leq x<5$}\\
\frac{35}{36}&\text{$5\leq x<6$}\\
1&\text{$x\geq 6$}\\
\end{dcases}
\]

The C.D.F can be graphed as follows:
\begin{center}
\begin{tikzpicture}
\begin{axis}[
clip=false,
jump mark left,
%ymin=0,ymax=1,
%xmin=0, xmax=5,
every axis plot/.style={very thick},
%discontinuous,
table/create on use/cumulative distribution/.style={
    create col/expr={\pgfmathaccuma + \thisrow{f(x)}}   
}
]
\addplot [red] table [y=cumulative distribution]{
x f(x)
0 0
1 11/36
2 20/36
3 27/36
4 32/36
5 35/36
6 1
};
\end{axis}
\end{tikzpicture}
\end{center}
\end{document}

enter image description here