5

I am plotting some 2D data from a file using pgfplots. Is it possible to automatically get (ymin,ymax) and (xmin,xmax) from the file I am trying to plot? I don't want to keep changing these each time I plot a different file.

Not setting these ranges will leave some undesired white spaces in my plots.

1

1 Answer 1

9

To prevent PGFPlots from adding padding around your data, set enlargelimits=false:

\documentclass[]{article}

\usepackage{pgfplots}

\begin{document}
Default settings:

\begin{tikzpicture}
\begin{axis}
\addplot table {
3 2
5 3
9 11
};
\end{axis}
\end{tikzpicture}

\hspace{2cm}


With \verb|enlargelimits=false|:

\begin{tikzpicture}
\begin{axis}[enlargelimits=false]
\addplot table {
3 2
5 3
9 11
};
\end{axis}
\end{tikzpicture}
\end{document}

You must log in to answer this question.

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