我有以下代码
\documentclass[danish,a4paper,12pt]{article} \usepackage{tikz,pgf} \usepackage{pgfplots} \begin{document} \begin{figure}[!h] \begin{tikzpicture} \begin{axis}[ width=100mm, height=85mm, scaled y ticks = false,% xmin = 0.00, ymin = 0.0, yticklabel style = {/pgf/number format/fixed, /pgf/number format/precision=3}, tick label style = {font=\footnotesize}, scale only axis, xmax = 0.85,ymax = 0.28, axis lines = left, xlabel = {Tid,$s$}, ylabel = {Hastighed$\frac{m}{s}$} ] \addplot[only marks,mark size=1.5pt] coordinates { (0.0,0.0) (0.0326,0.0599337793538) (0.066567,0.0800334092061) (0.099533,0.118183240821) (0.1335,0.162894171978) (0.166467,0.199695510686) (0.199433,0.224502399865) (0.2334,0.232532463933) (0.266367,0.234484998458) (0.300333,0.235156791863) (0.3333,0.236558243653) (0.366267,0.240320568046) (0.400233,0.237211598547) (0.4332,0.228133071563) (0.467167,0.22779717486) (0.500133,0.226828018266) (0.5331,0.224762107547) (0.567067,0.230861344422) (0.600033,0.239829235302) (0.634,0.237828910273) (0.666967,0.230542213422) (0.699933,0.23526158748) (0.7339,0.235532932594) (0.766867,0.228133071554) }; \end{axis} \end{tikzpicture} \caption{Scatter Plot over resultater i Bilag 2.} \label{fig:2} \end{figure} \end{document}
生成以下图表
我想做的是在同一张图表上添加一个函数。所以我添加了一行,
\addplot{0.20644-exp(-47.56*x)};
但是当我编译我的文档时,我的“图表”开始看起来像这样
答案1
您可以通过限制第二个函数的范围来解决此问题,例如:
\addplot[domain=0:.8,samples=100]{0.20644-exp(-47.56*x)};