I tried to use the datavisualization command (that uses this metod), an explicit function and shading, but it was more or less a 'dial it in' way of solving it, with having to scale the x and y coordinates with a factor 1.43 etc. Are there any better an a more 'solid' solution? TIA.

enter image description here




\pgfkeys{/pgf/fpu,/pgf/fpu/output format=fixed}%

\begin{tikzpicture}[declare function={f(\x)=100*exp(-0.24*\x)/14.3;}]
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,
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;


  • 1
    Please provide us with a complete document that is compilable as is. Even though you seem to have listed all relevant libraries, everyone who is willing to look at it will have to complete the document. – user194703 Jan 21 at 15:53
  • 1
    The factor 1.43 is of course nothing but (x_max-x_min)/width=(10-0)/7. – user194703 Jan 21 at 16:04
  • Thanks. I replaced the code now with a full working document. Yes the scaling is as you say, but a but cumbersome to use. Is there a cleaner method than the above? – mf67 Jan 21 at 17:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.