函数的虚线区域

函数的虚线区域

早上好,我正在尝试重现这张照片。在此处输入图片描述

这是我的代码

        \begin{tikzpicture}[holdot/.style={circle,draw,fill=white,inner sep=1.5pt}]
        \draw[help lines, color=gray, dashed] (-4,-2) grid (4,4);
        \draw[->,ultra thick] (-4,0)--(4,0) node[right]{$x$};
        \draw[->,ultra thick] (0,-2)--(0,4) node[above]{$y$};
        \path[pattern color=red,scale=1,pattern=north east lines] (0,0) -- (2.7,0) --(2.7,3.7)-- 
 (0,1)--(0,0) ; 
    \draw[thick,blue,domain=-1.57:1.57,samples=200] (-3,3) node[anchor=north west] {$f(x)=\arcsin(x)$} plot({sin(\x r)},\x);
\end{tikzpicture}

你能帮我完成这个吗?非常感谢

答案1

交换xy坐标是绘制反函数图像的好方法。就是这样!

在此处输入图片描述

\documentclass[tikz,border=5mm]{standalone}
\begin{document}
\begin{tikzpicture}[xscale=2]
\fill[blue!30] plot[domain=0:pi/2] ({sin(\x r)},\x) |- cycle;
\fill[red!30] plot[domain=0:-pi/2] ({sin(\x r)},\x) |- cycle;
\draw[->] (-1.5,0)--(1.5,0) node[right]{$x$};
\draw[->] (0,-pi/2-.5)--(0,pi/2+.5) node[above]{$y$};
\draw[dashed] 
(1,pi/2)--(0,pi/2) node[left]{$\frac{\pi}{2}$} 
(-1,-pi/2)--(0,-pi/2) node[right]{$-\frac{\pi}{2}$}
(1,pi/2)--(1,0) node[below]{$1$} 
(-1,-pi/2)--(-1,0) node[above]{$-1$}
;

\draw[teal,thick,smooth] plot[domain=-pi/2:pi/2] ({sin(\x r)},\x);
\path (-1,1) node[teal]{$f(x)=\arcsin(x)$} ;
\end{tikzpicture}
\end{document}

相关内容