我怎样才能使 y 轴箭头位于轴的另一端并指向下方?
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{makecell}
\setcellgapes{5pt}
\usepackage{booktabs}
\usepackage{amsmath,amssymb,amsfonts,systeme,mathtools}
\usepackage{chemfig}
\usepackage[version=3]{mhchem}
\usepackage{pgfplots}
\usepackage{float}
\begin{document}
\begin{figure}[H]
\centering
\begin{tikzpicture}
\begin{axis}[
legend pos=outer north east,
legend cell align={left},
grid, grid style=dashed,
xmax=1.1,xmin=0,
ymin=-1.2,ymax=0,
ytick={-1.1,-1,-0.9,-0.8,-0.7,-0.6,-0.5,-0.4,-0.3,-0.2,-0.1},
xtick={0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1},
extra y ticks={0}, % <---
extra x ticks={0}, % <---
axis lines = middle,
set layers, % <---
xlabel={$x_2$},ylabel={$V_m$},
x label style={at={(1,1)},right},
y label style={at={(0,0)},below},
]
\addplot[mark=*,scatter,only marks]
coordinates {
(0.0281,-0.115)(0.0435,-0.157)(0.0587,-0.262)(0.0896,-0.359)(0.1180,-0.500)(0.1524,-0.631)(0.3107,-0.894)(1,0)
};
\end{axis}
\begin{axis}[
legend pos=outer north east,
legend cell align={left},
hide axis,
ymin=-1.2,ymax=0,
xmax=1.1,xmin=0,
domain=0:1,
samples=2000,
set layers,
]
\addplot [cyan,smooth,thick,dashed] {4.3292*x*x - 4.3116*x - 0.0153};
\end{axis}
\end{tikzpicture}
\end{figure}
\end{document}
你能帮助我吗?
先感谢您
答案1
y axis line style={stealth-}
只需在选项末尾添加即可 axis
。
参见pgfplots
手册 p271 §4.9。轴描述(在 v1.15 中)
\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
legend pos=outer north east,
legend cell align={left},
grid, grid style=dashed,
xmax=1.1,xmin=0,
ymin=-1.2,ymax=0,
ytick={-1.1,-1,-0.9,-0.8,-0.7,-0.6,-0.5,-0.4,-0.3,-0.2,-0.1},
xtick={0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1},
extra y ticks={0}, % <---
extra x ticks={0}, % <---
axis lines = middle,
set layers, % <---
xlabel={$x_2$},ylabel={$V_m$},
x label style={at={(1,1)},right},
y label style={at={(0,-1)},above},
y axis line style={stealth-}, % <====== right here !
]
\addplot[mark=*,scatter,only marks]
coordinates {
(0.0281,-0.115)(0.0435,-0.157)(0.0587,-0.262)(0.0896,-0.359)(0.1180,-0.500)(0.1524,-0.631)(0.3107,-0.894)(1,0)
};
\end{axis}
\begin{axis}[
legend pos=outer north east,
legend cell align={left},
hide axis,
ymin=-1.2,ymax=0,
xmax=1.1,xmin=0,
domain=0:1,
samples=2000,
set layers,
]
\addplot [cyan,smooth,thick,dashed] {4.3292*x*x - 4.3116*x - 0.0153};
\end{axis}
\end{tikzpicture}
\end{document}