这就是我目前所拥有的
\def\FunctionF(#1){3/(#1)}
\begin{tikzpicture}
\begin{axis}[
axis y line=center,
axis x line=middle,
axis on top=true,
xmin=-4,
xmax=4,
ymin=-4,
ymax=4,
height=8.0cm,
width=8.0cm,
xtick=none,
ytick={1},
xlabel=$x$,
ylabel=$y$
]
\addplot[name path=F] [domain=-4:4, samples=100, mark=none,thick]
{\FunctionF(x)};
\draw [draw=none,name path=B] (axis cs:0,-4)--(axis cs:0,0)--(axis cs:-4,0)--(axis cs:-4,-4)--(axis cs:0,0);
\addplot[draw=none,name path=C] (axis cs:-4,0)--(axis cs:4,0);
\addplot[pattern=north east lines] fill between[of=F and C, soft clip={domain=4:0.7}];
\end{axis}
\end{tikzpicture}\\[0.2cm]
答案1
如果我正确理解了你的问题,那么你正在寻找类似这样的内容:
上面的图片由以下人员生成:
\documentclass[margin=3mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.15}
\usepgfplotslibrary{fillbetween}
\usetikzlibrary{intersections, patterns}
\begin{document}
\def\FunctionF(#1){3/(#1)}
\begin{tikzpicture}
\begin{axis}[
height=8.0cm, width=8.0cm,
axis lines=center,
axis on top,
xmin=-4, xmax=4,
ymin=-4, ymax=4,
xtick=\empty,
ytick={1},
xlabel=$x$,
ylabel=$y$
every axis plot post/.append style={ultra thick, color=blue!30},
domain=-4:4, samples=100, mark=none,
]
\addplot[name path=F] {\FunctionF(x)};
\path[name path=B] (-4,4) -- (0, 4)
(0,-4) -- (4,-4);
\addplot[pattern=north east lines, pattern color=gray!50]
fill between[of=F and B];
\end{axis}
\end{tikzpicture}
\end{document}