我无法将轴标签移动到我想要的位置,也无法将轴标记斜体化并减小数字的大小
\documentclass[a4paper]{article}
\usepackage[12pt]{extsizes}
\usepackage{cmap}
\usepackage[T2A]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english,russian]{babel}
\usepackage{caption}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm,bindingoffset=0cm]{geometry}
\usepackage{pgfplots}
\pgfplotsset{compat = newest}
\begin{document}
\begin{tikzpicture}[scale=1]
\begin{axis}[every axis plot post/.append style={
mark=none,
domain=0:400,samples=50,smooth},
xlabel = {$ h $},
ylabel = {$ W (h) $},
axis lines = middle,
axis x line=bottom,
axis y line=left,
grid = both,
major grid style = {lightgray},
minor grid style = {lightgray!25},
enlargelimits=upper]
\addplot[black, line width = 1pt] {sin(x)};
\end{axis}
\end{tikzpicture}
\end{document}
答案1
这是你想要的?
笔记:
- 我定义
Axis Labels At Tip
将标签移动到提示 - 删除了
axis x line=bottom
代码:
\documentclass[a4paper]{article}
\usepackage[12pt]{extsizes}
\usepackage{cmap}
\usepackage[T2A]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english,russian]{babel}
\usepackage{caption}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm,bindingoffset=0cm]{geometry}
\usepackage{pgfplots}
\pgfplotsset{compat = newest}
\pgfkeys{/pgfplots/Axis Labels At Tip/.style={
xlabel style={
at={(current axis.right of origin)},
anchor=west,
},
ylabel style={
at={(current axis.above origin)},
yshift=1.5ex, anchor=center
}
}
}
\begin{document}
\begin{tikzpicture}[scale=1]
\begin{axis}[every axis plot post/.append style={
mark=none,
domain=0:400,samples=50,smooth,
},
xlabel = {$ h $},
ylabel = {$ W (h) $},
axis lines = middle,
%axis x line=bottom,
axis y line=left,
grid = both,
major grid style = {lightgray},
minor grid style = {lightgray!25},
enlargelimits=upper,
Axis Labels At Tip,
]
\addplot[black, line width = 1pt] {sin(x)};
\end{axis}
\end{tikzpicture}
\end{document}