我认为只需使用以下方法更改轴标签的字体就很简单:
ylabel={$\frac{Su}{\sigma_{pc}^{'}}$ x},
ylabel style={font=\Huge},
但是它不起作用,我真的不明白为什么。以下是示例代码:
\documentclass[border=5pt]{standalone}
\usepackage{tikz,pgf,pgfplots} % To generate the plot from csv
\begin{document}
\begin{tikzpicture}%[dots/.style={circle,draw=blue,fill=blue, inner sep=-1pt}]
\begin{axis}[
% SIZE
scale only axis, % scale axis to specified size, otherwise
width=6cm,
height=6cm,%{},
% AXIS
grid,
grid style={solid,gray!50},
% TICKS
xticklabel pos=right,
% LABELS
xlabel={$\gamma_{zr} [\%]$},
x label style={above,font=\tiny},
xlabel near ticks,
ylabel={$\frac{Su}{\sigma_{pc}^{'}}$ x},
ylabel style={font=\tiny},
ylabel near ticks,
% LEGEND
legend style={at={(0.01,0.01)},anchor=south west,font=\scriptsize},
legend columns=1,
legend style={/tikz/column 3/.style={column sep=10pt}},
legend cell align=left,
]
\addplot [solid, black, mark=none, mark options={orange,scale=1}]{x^2};
\end{axis}
\end{tikzpicture}
\end{document}
答案1
xlabel near ticks
并使用/ylabel near ticks
覆盖所做的更改。交换顺序,它就可以正常工作了。xlabel style
ylabel style
xlabel near ticks
执行/pgfplots/every axis x label/.style={at={(ticklabel cs:0.5)},anchor=near ticklabel}
,而xlabel style
执行every axis x label/.append style={...}
。因此,当您xlabel style
首先拥有 时,您会将某些内容附加到 的现有定义中every axis x label
,但随后 会被 完全重新定义xlabel near ticks
,因此您会失去自定义。
(顺便说一句,tikz
加载pgf
,但是pgfplots
加载tikz
,因此明确加载所有三个并不是真正必要的。)
\documentclass[border=5pt]{standalone}
\usepackage{pgfplots} % To generate the plot from csv
\begin{document}
\begin{tikzpicture}%[dots/.style={circle,draw=blue,fill=blue, inner sep=-1pt}]
\begin{axis}[
% SIZE
scale only axis, % scale axis to specified size, otherwise
width=6cm,
height=6cm,%{},
% AXIS
grid,
grid style={solid,gray!50},
% TICKS
xticklabel pos=right,
% LABELS
xlabel={$\gamma_{zr} [\%]$},
xlabel near ticks,
x label style={above,font=\tiny},
ylabel={$\frac{Su}{\sigma_{pc}^{'}}$ x},
ylabel near ticks,
ylabel style={font=\Huge},
% LEGEND
legend style={at={(0.01,0.01)},anchor=south west,font=\scriptsize},
legend columns=1,
legend style={/tikz/column 3/.style={column sep=10pt}},
legend cell align=left,
]
\addplot [solid, black, mark=none, mark options={orange,scale=1}]{x^2};
\end{axis}
\end{tikzpicture}
\end{document}