문제

I want to draw an x-y-diagram with axis labels. Unfortunately the ylabel is misplaced. It looks as depending on the actual data. When the other data line in the sample below is used instead of the upper line, it looks better. How can I move the label to the left or (more desirable) how can I tell pgfplot to do it corectly?

% !TEX TS-program = pdflatex
% !TEX encoding = UTF-8 Unicode
\documentclass{scrartcl}
\usepackage[utf8]{inputenc} 
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
 \begin{tikzpicture}
 \begin{axis}[width=13cm,height=8cm,
  xlabel={I in mA}, ylabel={U in mV}]
  \addplot[only marks,mark=star] coordinates {
%   (1.36, -0.0177) (45.38, 0.0273) (74.19, 0.0413)
  (100.88, 0.0533) (134.80, 0.0683) (195.27, 0.1073)
  };
 \end{axis}
 \end{tikzpicture}
\end{document}
도움이 되었습니까?

해결책

pgfplots 1.3 has a new feature which allows to move axis labels tight to tick labels automatically. Since this affects the spacing, it is not enabled be default.

Use

\usepackage{pgfplots}
\pgfplotsset{compat=1.3}

in your preamble to benefit from the improved spacing.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top