使用所附代码,我得到了图片中的结果。在该范围内0-20
,曲线明显有急剧变化,这在美学上并不好。
有没有办法让曲线更平滑?谢谢
\begin{tikzpicture}
\begin{axis}[
width=\textwidth, height=10cm,
xlabel=$Pressure~(m~water)$,
ylabel={$Water~content~(v/v)$},
legend style={draw=none, legend columns=2, at={(.9,.9)}}]
\addplot+[blue,no marks,domain=0.001:160] {.508-1.52398*exp(-(13702.2/x)^0.13266)};
\addplot+[violet,no marks,domain=0.001:160] {.445-0.34900*exp(-(30.0706/x)^0.23650)};
\addplot+[red,no marks,domain=0.001:160] {.503-0.41288*exp(-(1.56530/x)^0.66572)};
\addplot+[orange,no marks,domain=0.001:160] {.465-0.39848*exp(-(0.67406/x)^0.84737)};
\addplot+[green,no marks,domain=0.001:160] {.350-0.31765*exp(-(0.53648/x)^1.21892)};
\addplot+[brown,no marks,domain=0.001:160] {.395-0.38594*exp(-(0.07439/x)^0.92067)};
\legend{Silty clay, Clay loam, Loam, Sandy loam, Medium fine loam, Coarsesand};
\end{axis}
\end{tikzpicture}
答案1
虽然该选项smooth
使曲线更平滑,但也会导致边缘偏离,从而使图形不准确。最好使用samples
key 并增加样本数量。样本越多,曲线越细。这里唯一的限制因素是编译时间和内存。下面是一个示例samples=500
。
\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
width=\textwidth, height=10cm,
xlabel=$Pressure~(m~water)$,
ylabel={$Water~content~(v/v)$},
legend style={draw=none, legend columns=2, at={(.9,.9)}}]
\addplot+[blue,no marks,domain=0.001:160,samples=500] {.508-1.52398*exp(-(13702.2/x)^0.13266)};
\addplot+[violet,no marks,domain=0.001:160,samples=500] {.445-0.34900*exp(-(30.0706/x)^0.23650)};
\addplot+[red,no marks,domain=0.001:160,samples=500] {.503-0.41288*exp(-(1.56530/x)^0.66572)};
\addplot+[orange,no marks,domain=0.001:160,samples=500] {.465-0.39848*exp(-(0.67406/x)^0.84737)};
\addplot+[green,no marks,domain=0.001:160,samples=500] {.350-0.31765*exp(-(0.53648/x)^1.21892)};
\addplot+[brown,no marks,domain=0.001:160,samples=500] {.395-0.38594*exp(-(0.07439/x)^0.92067)};
\legend{Silty clay, Clay loam, Loam, Sandy loam, Medium fine loam, Coarsesand};
\end{axis}
\end{tikzpicture}
\end{document}