我尝试标记原点O(0,0)
,点A(1,0)
并在两个函数的绘图上画一条虚线,使用
\documentclass[11pt]{article}
\usepackage{tikz,pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}
[
axis lines=middle,
axis equal image,
xlabel=$x$, xlabel style={at=(current axis.right of origin), anchor=west},
ylabel=$y$, ylabel style={at=(current axis.above origin), anchor=south},
xtick={6}, ytick={6}, no marks, xmin=-1, xmax=5, ymin=-1, ymax=2,
enlargelimits={upper=0.1},
]
\addplot [blue,domain=0:1] {-2*x^2+3*x};
\addplot [red,domain=1:5] {1/x};
\addplot [black,domain=0:5] {1/(x+1)};
\draw node[below left] at (0,0) {$O$};
\draw node[below left] at (1,0) {$A$};
\draw[style=densely dotted,color=black](1,0) -- (1,1);
\end{axis}
\end{tikzpicture}
\end{document}
为什么O
、、A
和线是不可见的,我该如何解决这个问题?