3

When using the scale key for tikzpicture, the axis labels of pgfplots are no longer in the correct place. In the example below, the first axis environment is not within a scaled tikzpicture environment and the axis labels are placed correctly. The second axis environment is in a scaled tikzpicture environment and the axis labels are not placed correctly. The third axis environment has the same problem even when the transform shape key is given to the scaled tikzpicture environment.

How can I scale the tikzpicture environment and still get the axis labels to appear in the correct positions?

enter image description here

\documentclass{article}
\usepackage{pgfplots}
\usepackage{tikz}
\begin{document}
 \begin{tikzpicture}
  \begin{axis}[xlabel=$x$, ylabel=$y$, axis lines=center]
   % empty
  \end{axis}
 \end{tikzpicture}\\
 \begin{tikzpicture}[scale=0.5]
  \begin{axis}[xlabel=$x$, ylabel=$y$, axis lines=center]
   % empty
  \end{axis}
 \end{tikzpicture}\\
 \begin{tikzpicture}[scale=0.5,transform shape]
  \begin{axis}[xlabel=$x$, ylabel=$y$, axis lines=center]
   % empty
  \end{axis}
 \end{tikzpicture}
\end{document}

1 Answers1

3

Move the scale=.5 and transform shape to the local axis options, like:

\begin{axis}[xlabel=$x$, ylabel=$y$, axis lines=center, scale=.5, transform shape]

Here's how it looks:

figure 1

Alenanno
  • 37,338