作者:王美庭
一押袍、練習(xí)結(jié)果圖
二、具體代碼
%采用pdflatex編譯(速度大大提升)
\documentclass[12pt,a4paper,UTF8]{ctexart}
\usepackage{tikz}
\usepackage{siunitx} %需要用到\ang[options]{degrees}命令
\newcommand{\iangle}{120}
%\usepackage{ctex}
\usepackage[landscape]{geometry} %使得頁面橫置
%對于中文字體的處理:pdfLaTeX用CJK包或ctex包會出錯沦童,而用\documentclass[UTF8]{ctexart}則沒有問題仑濒。
\begin{document}
\begin{figure}[htbp]
\centering
\begin{tikzpicture}[scale=2.8] %scale參數(shù)可以使得圖形放大一定的倍數(shù)而本身的字體大小可以保持不變。
%畫左邊的圓
%scope環(huán)境里夠成一整個區(qū)塊偷遗,然后可以使這一整個區(qū)塊進(jìn)行平移墩瞳。
\begin{scope}[xshift=-1.75cm]
\fill[fill=gray,fill opacity=0.2]
(0,0) -- (0:1) arc (0:\iangle:1) -- cycle;
\filldraw[fill=gray,fill opacity=0.5]
(0,0) --(0:0.3) arc (0:\iangle:0.3) -- cycle;
\draw[->] (-1.2,0) -- (1.2,0);
\draw[->] (0,-1.2) -- (0,1.2);
\draw[thick] (0,0) circle (1);
\coordinate[label=\iangle:$P$] (P) at (\iangle:1);
\coordinate[label=below:$P_0$] (P0) at (P |- 0,0);
\draw (0,0) -- (P);
\draw (P) -- (P0);
\node[right] at (\iangle/2:0.3) {\ang{\iangle}};
\end{scope}
%畫右邊的正弦曲線
\draw[->] (0,0) -- ({rad(210)},0);
\draw[->] (0,-1.2) -- (0,1.2);
\draw[thick,domain=0:rad(210)] plot(\x,{sin(\x r)}) node[right] {$\sin x$};
\foreach \t in {0,90,180} {
\draw ({rad(\t)},-0.05) -- ({rad(\t)},0.05);
\node[below,outer sep=2pt,fill=white,font=\small]
at ({rad(\t)},0) {\ang{\t}};
}
\foreach \y in {-1,1} {
\draw (-0.05,\y) -- (0.05,\y);
}
\coordinate[label=above:$Q$] (Q) at ({rad(\iangle)},{sin(\iangle)});
\coordinate[label=below:$Q_0$] (Q0) at (Q |- 0,0);
\draw (Q) -- (Q0);
%左右相互連接
\draw[dashed] (P) -- (Q);
\end{tikzpicture}
\caption{正弦函數(shù)與單位圓(TikZ實現(xiàn))}
\end{figure}
\end{document}
備注:代碼借鑒至劉海洋的《LaTeX入門》