# Removing white space around tikz number line?

I'm having this problem with tikz in which I'm trying to create this simple number line but a load of unnecessary white spaces pops up:

 \item
As a real-number-line graph:\\
\begin{tikzpicture}
\begin{axis}[
axis x line=middle,
axis y line=none,
xtick={-3,-2,...,4,5}
]
\end{axis}
\end{tikzpicture}
\item
Interval Notation:\\


The result looks like this:

How would I remove all this white space? Also, why is there so much white space?

Thanks.

• Welcome! You need to set the ‘height ‘ and ‘width’ of the axis to the values you like.
– user194703
Sep 12, 2019 at 5:48
• Hi, welcomme , Please give a compileable minimum example starting with \documentclass{...} and ending with \end{document} Sep 12, 2019 at 5:49
• @Schrödinger'scat Thank you so much; exactly what I needed.
– ssp
Sep 12, 2019 at 5:54
• You're welcome! (Most likely you have a \pgfplotset{...,width=...} and/or \pgfplotset{...,width=...} somewhere in your file. If you remove this global option you should also be fine.
– user194703
Sep 12, 2019 at 7:17
• @Schrödinger'scat I don't, actually. I do have \usepackage[margin=1in]{geometry} but I doubt that affects anything..
– ssp
Sep 12, 2019 at 7:38

tikzpicture in has default height. You need to reduce it to some small value, but not to small (<16mm) since than you will receive error:

Package pgfplots Error: Error: Plot height 42.67912pt' is too small. This ca
nnot be implemented while maintaining constant size for labels. Sorry, label si


See, if the following MWE gives what you like to have:

\documentclass{article}
\usepackage{pgfplots}

\begin{document}
\begin{enumerate}
\item   As a real-number-line graph:

\begin{tikzpicture}
\begin{axis}[
height=20mm, width=90mm,    % <---
axis x line=bottom,
axis y line=none,
axis line style=-,          % <---
xtick={-3,-2,...,4,5},
ymin = 0, ymax = 1,         % <---
]
`