# Plot function in given coordinate system

I have a coordinate system and need to plot linear functions in this coordinate system. The problem is that the functions only get plotted from x=-5 to x=5, although I set xmin=-11 and xmax=11. A way to resolve the plotting problem is to leave out xmin and xmax, but that messes up my coordinate system.

How can I make the plots go from xmin to xmax, while leaving the coordinate system as it is?

My code:

\documentclass[border=2pt]{standalone}
\usepackage{pgfplots}
\begin{document}

\begin{tikzpicture}
\begin{axis}[
xmin=-11,xmax=11,
ymin=-11,ymax=11,
grid=both,
grid style={line width=.1pt, draw=darkgray!10},
major grid style={line width=.2pt,draw=darkgray!50},
axis lines=middle,
minor tick num=4,
enlargelimits={abs=0.5},
axis line style={latex-latex},
samples=100,
]
\end{axis}
\end{tikzpicture}

\end{document}


My output:

You seem to be confusing the xmin/xmax keys, which set the boundaries of the window with the domain key, which is what you want.

## Complement : default key values

• as you noticed, the domain key has default value -5:5
• if left unspecified, the x/y/z - min/max keys are computed to fit the data provided to \addplot. In your case, you therefore would not need to specify the xmin/xmax keys, only the domain one.

## Code

\documentclass[border=2pt]{standalone}
\usepackage{pgfplots}
\begin{document}

\begin{tikzpicture}
\begin{axis}
[
xmin=-11,xmax=11, % not needed if domain=-11:11,
ymin=-11,ymax=11,
grid=both,
grid style={line width=.1pt, draw=darkgray!10},
major grid style={line width=.2pt,draw=darkgray!50},
axis lines=middle,
minor tick num=4,
enlargelimits={abs=0.5},
axis line style={latex-latex},
samples=100,% you only need 2 for lines
domain = -11:11,
]