我正在尝试添加指向下图轴线的箭头:
\documentclass{article}
\usepackage{xcolor}
\usepackage{pgfplots}
\usepackage{amsmath}
\begin{document}
\begin{figure}[ht]
\centering
\begin{tikzpicture}[scale=1.75,line width=1pt]
\begin{axis}[
color= gray,
xmin=-4.9,
xmax=4.9,
ymin=-1.9,
ymax=2.9,
axis equal image,
axis lines=middle,
font=\scriptsize,
xtick distance=1,
ytick distance=1,
xticklabels={},
yticklabels={},
legend pos=outer north east,
]
\addplot[red, smooth, domain=-4.9:4.9] {(8)/(4 + x^2)};
\addlegendentry{$f(x)$}
\addplot[blue, smooth, domain=-4.9:4.9]{(-16*x)/((4+x^2)^2)};
\addlegendentry{$f'(x)$}
\addplot[green, smooth, domain=-4.9:4.9]{-(((16)*((4 + x^2)^2))-((4 + x^2)*
(64*(x^2))))/((4+x^2)^4)};
\addlegendentry{$f''(x)$}
\end{axis}
\end{tikzpicture}
\caption{Plotting the curve when $r=1$.}
\label{fig:1}
\end{figure}
\end{document}
以下是代码的输出:
看到只有轴线的顶部和右端有箭头指针,而底部和左端没有吗?有没有办法让我在四个端点都得到一些箭头指针?
谢谢!
答案1
添加
every inner x axis line/.append style={stealth-stealth},
every inner y axis line/.append style={stealth-stealth},
在轴选项的末尾,就在之后legend pos=outer north east,
和之前]
请参阅现行参考手册。
如果您对它们相同感到满意,那么您可以只设置一个键(如评论中指出的那样):
inner axis line style={stealth-stealth}