![我怎样才能修复双曲线的 y 轴?](https://linux22.com/image/412851/%E6%88%91%E6%80%8E%E6%A0%B7%E6%89%8D%E8%83%BD%E4%BF%AE%E5%A4%8D%E5%8F%8C%E6%9B%B2%E7%BA%BF%E7%9A%84%20y%20%E8%BD%B4%EF%BC%9F.png)
我正在尝试画出这条双曲线。我试过
\documentclass[tikz,border=3mm]{standalone}
%\usepackage{mathtools}
\begin{document}
\begin{tikzpicture}
\pgfmathsetmacro{\a}{1}
\pgfmathsetmacro{\b}{1}
\draw[thick, ->] (-6,0) -- (6,0) node[right]{$x$};
\draw[thick, ->] (0,-6) -- (0,8) node[above]{$y$};
\draw (0,4) node[right]{$4$};
\draw [fill=black] (0,4) circle (1.5pt);
\draw [fill=black] (0,0) circle (1.5pt);
\draw[thick] plot[domain=-2.5:2.5] ({\a*cosh(\x)},{\b*sinh(\x)});
\draw[thick] plot[domain=-2.5:2.5] ({-\a*cosh(\x)},{\b*sinh(\x)});
\draw[thick] (0,0) circle[radius = 1];
\draw[thick] (0,4) circle[radius = 3];
\end{tikzpicture}
\end{document}
我该如何修复?
答案1
我想现在我可能理解得更清楚了。你想改变绘图范围。据我所知,目前asinh
pgf 中还没有实现,但对于中等大小的负参数,你可以近似
sinh(x) = (exp(x) - exp(-x))/2 ~ -exp(-x)/2 for x << -1
这意味着
asinh(x) ~ -2 ln(|x|)。
因此,我们可以选择域为domain=-{ln(4)}:3
,
\documentclass[tikz,border=3mm]{standalone}
%\usepackage{mathtools}
\begin{document}
\begin{tikzpicture}
\pgfmathsetmacro{\a}{1}
\pgfmathsetmacro{\b}{1}
\draw[thick, ->] (-6,0) -- (6,0) node[right]{$x$};
\draw[thick, ->] (0,-2) -- (0,8) node[above]{$y$};
\draw (0,4) node[right]{$4$};
\draw [fill=black] (0,4) circle (1.5pt);
\draw [fill=black] (0,0) circle (1.5pt);
\begin{scope}
\draw[thick] plot[domain=-{ln(4)}:3] ({\a*cosh(\x)},{\b*sinh(\x)});
\draw[thick] plot[domain=-{ln(4)}:3] ({-\a*cosh(\x)},{\b*sinh(\x)});
\end{scope}
\draw[thick] (0,0) circle[radius = 1];
\draw[thick] (0,4) circle[radius = 3];
\end{tikzpicture}
\end{document}
或者我们也可以只剪辑。
\documentclass[tikz,border=3mm]{standalone}
%\usepackage{mathtools}
\begin{document}
\begin{tikzpicture}
\pgfmathsetmacro{\a}{1}
\pgfmathsetmacro{\b}{1}
\draw[thick, ->] (-6,0) -- (6,0) node[right]{$x$};
\draw[thick, ->] (0,-2) -- (0,8) node[above]{$y$};
\draw (0,4) node[right]{$4$};
\draw [fill=black] (0,4) circle[radius=1.5pt] (0,0) circle[radius=1.5pt];
\clip (-6,-2) rectangle (6,8);
\draw[thick] plot[domain=-2.5:2.5] ({\a*cosh(\x)},{\b*sinh(\x)});
\draw[thick] plot[domain=-2.5:2.5] ({-\a*cosh(\x)},{\b*sinh(\x)});
\draw[thick] (0,0) circle[radius = 1];
\draw[thick] (0,4) circle[radius = 3];
\end{tikzpicture}
\end{document}
使用 pgfplots 这变得几乎微不足道:ymin=-2
。
\documentclass[tikz,border=3mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.17}
\begin{document}
\begin{tikzpicture}
\pgfmathsetmacro{\a}{1}
\pgfmathsetmacro{\b}{1}
\begin{axis}[axis lines=middle,xtick=\empty,ytick={4},
xlabel=$x$,ylabel=$y$,axis equal image,
ymin=-2,ymax=8,
domain=-2.5:2.5]
\draw [fill=black] (0,4) circle[radius=1.5pt] (0,0) circle[radius=1.5pt];
\addplot[thick] ({\a*cosh(x)},{\b*sinh(x)});
\addplot[thick] ({-\a*cosh(\x)},{\b*sinh(\x)});
\draw[thick] (0,0) circle[radius = 1];
\draw[thick] (0,4) circle[radius = 3];
\end{axis}
\end{tikzpicture}
\end{document}