我尝试使用 datavisualization 命令(使用这方法)、显式函数和阴影,但它或多或少是一种“拨号”式的解决方法,必须用 1.43 倍的因子缩放 x 和 y 坐标等。有没有更好、更“可靠”的解决方案?TIA。
\documentclass[10pt]{book}
\usepackage{pgfplots}
\pgfplotsset{compat=1.15}
\usepackage{pgf,tikz}
\begin{document}
\usetikzlibrary{datavisualization.formats.functions}
\newcommand{\pgfmathparseFPU}[1]{\begingroup%
\pgfkeys{/pgf/fpu,/pgf/fpu/output format=fixed}%
\pgfmathparse{#1}%
\pgfmathsmuggle\pgfmathresult\endgroup}
\begin{center}
\begin{tikzpicture}[declare function={f(\x)=100*exp(-0.24*\x)/14.3;}]
\datavisualization[
scientific axes={clean},
all axes = grid,
x axis = {length=7cm, min value=0, max value=10, grid={step=1}},
y axis = {length=7cm, min value=0, max value=100},
visualize as smooth line,
/pgf/data/evaluator=\pgfmathparseFPU
]
data[format = function]
{
var x : interval[0:10];
func y = 100*exp(-0.24*\value x);
};
\draw[thick,dashed] (5/1.43,{f(5)})--(5/1.43,0);
Shade grey area underneath curve.
\fill [fill=black!60,opacity=.2] (0,0) -- plot[domain=0:5] ({\x/1.43},{f(\x)}) -- (5/1.43,0) -- cycle;
\end{tikzpicture}
\end{center}
\end{document}