我正在尝试修改此图表(我想绘制类似于等边双曲线的图表
我的代码是:
\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}