用 tikz 绘制曲线

用 tikz 绘制曲线

enter image description here

我想使用控件绘制一条曲线(如图所示)。请大家帮帮我!

答案1

你可以玩和inout为了获得平滑的曲线,你只需确保两个连续点的inout参数相差 180 度。使用松散度,你可以进一步控制曲线的形状。

enter image description here

\documentclass[tikz,border=3.14pt]{standalone}
\begin{document}
\begin{tikzpicture}
\draw[gray] (-1,-3) grid (9,4);
\draw[thick,-latex] (-1,0) -- (9,0) node[below left]{$x$};
\draw[thick,-latex] (0,-3) -- (0,4) node[below right]{$y$};
\draw[thick,blue] (0,0) to[out=-70,in=180] (1.2,-1.5) 
to [out=0,in=180,looseness=0.4] (5.8,3.9) to[out=0,in=120,looseness=0.5] (8,0);
\node[anchor=north west] at (5,0) {5};
\node[anchor=north east] at (0,0) {0};
\node[anchor=south east] at (0,1) {2};
\end{tikzpicture}
\end{document}

相关内容