# Dot plot with small axis values

I am trying to produce a dot plot where the horizontal axis represents probability.

At the moment, running the following code generates a very squashed dot plot, like the image in the screenshot.

How would you modify this code so that the horizontal axis stretches, with appropriate labels (0.1, 0.2, ...,0.9, 1) ?

Thank you.

\documentclass[]{article}
\usepackage[margin=0.5in]{geometry}
\usepackage{pgfplots}
\usepackage{mathtools}
\usepgfplotslibrary{statistics}
\newenvironment{tightcenter}{
\setlength\topsep{0pt}
\setlength\parskip{0pt}
\begin{center}}{\end{center}}
\begin{document}
\begin{center}
\begin{tikzpicture}[x={(1.5,0)}]
\draw[latex-latex] (0,0) -- (1,0);
\foreach \x in  {0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0}
\draw[shift={(\x,0)},color=black] (0pt,1pt) -- (0pt,-1pt);
\foreach \x in {0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0}
\draw[shift={(\x,0)},color=black] (0pt,0pt) -- (0pt,-1pt) node[below]
{$\pgfmathprintnumber[fixed,fixed zerofill,precision=1]{\x}$};
\draw[fill=black] (0.5,0.5) circle (2pt);
\draw[fill=black] (0.5,1.0) circle (2pt);
\draw[fill=black] (0.5,1.5) circle (2pt);
\end{tikzpicture}
\end{center}
\end{document}

• You are loading pgfplots and its statistics library, but not using it at all. Why? If you use it, you can adjust the width with the pgfplots key width. – Schrödinger's cat Aug 29 '19 at 22:50
• E.g. \documentclass[]{article} \usepackage[margin=0.5in]{geometry} \usepackage{pgfplots} \pgfplotsset{compat=1.16,width=0.9\textwidth} \begin{document} \begin{center} \begin{tikzpicture} \begin{axis}[axis lines=left,ymin=0,ymax=2,hide y axis,xmin=0,xmax=1] \addplot[only marks,mark=*] coordinates {(0.5,0.5) (0.5,1.0) (0.5,1.5)}; \end{axis} \end{tikzpicture} \end{center} \end{document} – Schrödinger's cat Aug 29 '19 at 22:55

As pure tikz solution, based on slightly modified your MWE:

\documentclass{article}
\usepackage[margin=0.5in]{geometry}
\usepackage{tikz}

\begin{document}
\begin{center}
\dimendef\mydimen=0                 % define new dimension name
\pgfmathsetlength{\mydimen}{+1.2cm} % define units used in tikzpicture
\begin{tikzpicture}[x=\mydimen, y=0.8\mydimen] % define ratio width/height
\draw[latex-latex] (0,0) -- (10,0);
\foreach \x [evaluate=\x as \xx using \x/10]  in {0,1,...,10}
\draw   (\x,2pt) -- ++ (0,-4pt) node[below, font=\scriptsize]
{$\pgfmathprintnumber[fixed,precision=1]{\xx}$};
%
\foreach \i in {1,2,3}
\fill (5,\i) circle (2pt);
\end{tikzpicture}
\end{center}
\end{document}