pgfplot 标签有问题

发布于 2024-08-30 06:33:30 字数 615 浏览 3 评论 0原文

我想绘制带有轴标签的 xy 图。不幸的是,ylabel 放错了地方。看起来取决于实际数据。当使用下面示例中的其他数据线代替上面的线时,看起来更好。 如何将标签移至左侧或者(更理想)如何告诉 pgfplot 正确执行此操作?

% !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}

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}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

情深已缘浅 2024-09-06 06:33:46

pgfplots 1.3 有一个新功能,允许自动将轴标签移动到刻度标签。由于这会影响间距,因此默认情况下不启用。

使用可以从改进的间距中受益。

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

在序言中

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文