绘图功能

绘图功能

我必须绘制圆角图(像黑线) 在此处输入图片描述

答案1

你可以用..controls(A)and(B).. 它来控制线的曲率,我们可以使用四个点(见图)

在此处输入图片描述

代码

\documentclass[margin=1cm]{standalone}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}[>=stealth]

% draw axis
\draw[->,thick](0,-2.2)--(0,4.7);
\draw[->,thick](-7,0)--(7,0);

% draw ticks
\foreach \i in{-6,-5,...,6}{\draw(\i,0)--(\i,-0.1);}
\foreach \i in{-6.5,-5.5,...,7.5}{\draw(\i,0)--(\i,-0.05);}
\foreach \j in{-2,-1,...,4}{\draw(0,\j)--(-0.1,\j);}
\foreach \j in{-1.5,-0.5,...,4.5}{\draw(0,\j)--(-0.05,\j);}

% draw red lines
\draw[red,thick](-2,-2.2)--(-2,4.7);
\draw[red,thick](2,-2.2)--(2,4.7);
\node[below left,red]  at (2,0) {\scriptsize $\beta$};
\node[below right,red] at (-2,0){\scriptsize $-\beta$};

% draw function and node near plot 
\draw[blue,very thick](-7,-1.5)..controls(-2,-1.5)and(-3.4,-0.3)..(-2,0)--(2,0)..controls(3.4,0.3)and(2,1.5)..(7,1.5)node[pos=0.65,above]{\scriptsize $\varphi_{\gamma,\beta}(\sigma)$};
\end{tikzpicture}


\end{document}

输出

在此处输入图片描述

相关内容