1
\documentclass[letter,12pt]{article}
\usepackage{pgfplots}
\pgfplotsset{tyyli/.append style={axis x line=middle, axis y line=
middle, xlabel={$x$}, ylabel={$y$}, axis equal }}
\pgfplotsset{every x tick label/.append style={font=\tiny, yshift=0.5ex}}
\pgfplotsset{every y tick label/.append style={font=\tiny, xshift=0.5ex}}
\usepackage[margin=1.5cm]{geometry}
\usepackage{tikz}
\usepackage[english]{babel}

\begin{document}
\begin{tikzpicture}[scale=2]
\begin{axis}[tyyli,xtick={-10,-8,...,10}, ytick={-10,-8,...,10},
xmin=-10, xmax=10 , ymin=-10, ymax=10, grid=both]
\end{axis}
\end{tikzpicture}
\end{document}

The problem is that x label is nowhere and y label is at the top of the page when the picture is at the bottom.

coordinate plane with misplaced axis label

1

See here: pgfplots axis labels in wrong place after scaling

The basic idea is to delete the [scale=2] argument from \begin{tikzpicture} and add scale=2 to the axis arguments.

Here is a MWE.

\documentclass[letter,12pt]{article}
\usepackage{pgfplots}

\pgfplotsset{every x tick label/.append style={font=\tiny, yshift=0.5ex}}
\pgfplotsset{every y tick label/.append style={font=\tiny, xshift=0.5ex}}
\usepackage[margin=1.5cm]{geometry}
\usepackage{tikz}
\usepackage[english]{babel}

\begin{document}
    \begin{tikzpicture} % don't put [scale=2] here
    \begin{axis}[xtick={-10,-8,...,10}, ytick={-10,-8,...,10},
    xmin=-10, xmax=10 , ymin=-10, ymax=10, grid=both, axis lines=center, ylabel={$y$}, xlabel={$x$}, scale=2]
    \end{axis}
    \end{tikzpicture}
\end{document}
  • That worked, I wouldn't have guessed it was about scaling! – Jenni T Sep 27 at 20:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.