我想改变轴附近的 ylabel 的位置。
答案1
查看ylabel shift
选项,可用于将标签移动一定量,例如
\begin{axis}[ylabel shift = 1 pt]
...
\end{axis}
(您需要具有\pgfplotsset{compat = 1.3}
或更高版本号才能正常工作。)
答案2
ylabel near ticks
尝试在环境中添加axis
如下选项
\begin{axis}[..., ylabel near ticks, ...]
...
\end{axis}
无需为此选项赋值。
答案3
以下代码适合您
%----------------------------------------------
\pgfplotsset{every axis legend/.style={
cells={anchor=center},% Centered entries
inner xsep=3pt,
inner ysep=2pt,
nodes={inner sep=2pt,text depth=0.15em},
anchor=south east,
shape=rectangle, %box shape
fill=white, %box inside
draw=white, %box color
at={(rel axis cs:0.90,1.0)} %box position right top
}}
%-------------------------------------------
\begin{axis}
[
ylabel style={yshift=0.4cm}, %shifting the y line text
]