I am having trouble drawing the following probability distribution:
I am not very sure about how I can do this. I've looked at sample plot functions using PGF Plots and Tikz, but I haven't been able to find very many posts regarding discrete probability distributions. I was thinking about maybe plotting the lines x = -2, -1, 0, 1, 2, and then somehow constraining the graph to my desired interval, but I didn't get anywhere with this approach either.
EDIT: Here is something that I found online that I've been working with:
\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{tikz}
\usepackage{pgfplots}
\newcommand{\prob}[1]{\ensuremath{\text{P}\left(#1\right)}}
\begin{document}
\pgfplotsset{
standard/.style={
axis x line=middle,
axis y line=middle,
enlarge x limits=0.15,
enlarge y limits=0.15,
every axis x label/.style={at={(1,0.1)},anchor=north west},
every axis y label/.style={at={(0.1,1.1)},anchor=north},
every axis plot post/.style={mark options={fill=black}}
}
}
\begin{center}
\begin{tikzpicture}
\begin{axis}[
standard,
domain = -4:4,
samples = 9,
xlabel={$x$},
xmin=-2,
xtick= {-2, -1, 0, 1, 2},
xmax= 2,
ylabel={$\prob{Y=x}$},
ymin=0,
yticklabel={$\frac{\pgfmathprintnumber{\tick}}{16}$},
ytick = {1, 2, 3, 4, 5, 6},
ymax=6]
\addplot+[ycomb,black,thick] {(abs(x))};
\end{axis}
\end{tikzpicture}
\end{center}
\end{document}



/pgf/declare functionand then we will look at the remaining problem. – Stefan Pinnow Oct 04 '18 at 19:45\probwhich you can check out. Having a proper MWE is vital for easing other users' attempts to help. – Thev Oct 04 '18 at 20:18