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:

As a real-number-line graph:\\
            axis x line=middle,
            axis y line=none,
            \addplot[line width=0.4mm, draw=blue][domain=-3:5]{0};
            \addplot[draw=blue, fill=white, mark=*] coordinates {(-3,0)(1,0)(5,0)};
Interval Notation:\\

The result looks like this:

enter image description here

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


  • 1
    Welcome! You need to set the ‘height ‘ and ‘width’ of the axis to the values you like.
    – user194703
    Sep 12, 2019 at 5:48
  • 2
    Hi, welcomme , Please give a compileable minimum example starting with \documentclass{...} and ending with \end{document}
    – AndréC
    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

1 Answer 1


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
zes are only approximate. You will need to adjust your height..

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


\item   As a real-number-line graph:

height=20mm, width=90mm,    % <---
axis x line=bottom,
axis y line=none,
axis line style=-,          % <---
ymin = 0, ymax = 1,         % <---
\addplot[draw=blue, thick, fill=white, mark=*]  
    coordinates {(-3,0) (1,0) (5,0)};
\item   Interval Notation:

enter image description here


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .