所以我想画出图表
y=(3^(x))+(-1)
y=(3^(-x))+3
带标签和细网格
清晰地显示渐近线。清楚地
我曾尝试过以下
\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
axis lines=middle,
clip=false,
ymin=0,
xticklabels=\empty,
yticklabels=\empty,
legend pos=north west
]
\addplot+[mark=none,samples=200,unbounded coords=jump] {(3^(x))+(-1)};
\legend{$y=\sqrt{x}$}
\draw[fill] (axis cs:4,0) circle [radius=1.5pt] node[below right] {$(4,0)$};
\draw[fill] (axis cs:{4.5,sqrt(4.5)}) circle [radius=1.5pt] node[above left] {$(x,y)$};
\end{axis}
\end{tikzpicture}
\end{document}
但无法生成 +(-1) 部分
答案1
你的意思是......之类的吗?
\documentclass[border=2pt]{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
legend pos=north west,
axis lines=middle,
xmax=5,
ymin=-2,
ymax=10,
% xticklabels=\empty,
% yticklabels=\empty,
% add some extra ticks with a different style to show the asymptotes
extra y ticks={-1,3},
extra y tick style={
grid=major,
},
% % if you don't need the numbers ...
% extra y tick labels={},
no markers,
samples=200,
]
\addplot {(3^(x))+(-1)};
\addplot {(3^(-x))+3};
% % alternatively add some more constant plots where you choose
% % a custom style for each asymptote
% \addplot [blue!50,samples=2,forget plot] {-1};
% \addplot [red!50,samples=2,forget plot] {3};
\legend{
$3^x - 1$,
$3^{-x} + 3$,
}
\end{axis}
\end{tikzpicture}
\end{document}