怎样画等边双曲线?

怎样画等边双曲线?

我正在尝试修改此图表(我想绘制类似于等边双曲线的图表

在此处输入图片描述

我的代码是:

\documentclass[border=2pt] {standalone}
%\usepackage{tikz}
%\usetikzlibrary{calc}
\usepackage{pgf,tikz}
\usetikzlibrary{arrows}
%\usetikzlibrary{arrows.meta}
\begin{document}
\definecolor{qqqqff}{rgb}{0.0,0.0,1.0}
\definecolor{xdxdff}{rgb}{0.49019607843137253,0.49019607843137253,1.0}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1.0cm,y=1.0cm]
\draw [->,line width=1.2pt] (0.0,0.0) -- (0.0,5.0);
\draw [->,line width=1.2pt] (0.0,0.0) -- (5.0,0.0);
\draw [line width=2.0pt] (0.0,2.0)-- (4.0,4.0);
\begin{scriptsize}
%\draw [fill=black] (0.0,2.0) circle (2.5pt);
\draw[color=black] (-1.0,4.5) node {\huge $y$};
\draw[color=black] (4.5,-0.5) node {\huge $x$};
\end{scriptsize}
\end{tikzpicture}
\end{document}

答案1

这是一条1.0/x双曲线pgfplots——别忘了使用axis环境

\pgfplotssetup命令对于多张图片的相同设置非常有用。

\documentclass[border=2pt] {standalone}
\usepackage{pgfplots}


\pgfplotsset{compat=1.13, % 1.13 is current version
  grid=both,
  axis lines=middle,
  scale only axis,
  xlabel=\(x\),
  ylabel=\(y\),
  major grid style={thick},
}


\begin{document}

\begin{tikzpicture}
\begin{axis}[xtick={-1,-0.5,...,4},xmin=-1,xmax=4, minor xtick={-0.5,0.5,...,3.5}, ymin=-0.5, ymax=5, ytick={0.0,0.5,...,4.5}]
  \addplot[samples=200,domain=0.01:4, line width=1.5pt, blue] {1.0/x)};
\end{axis}
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容