我目前正在尝试改善形象de.wikipedia.org/wiki/Datei:TrigEinheitskreis.png/ 创建它的免费版本。
乳胶
这是我目前得到的:
\documentclass{article}
\usepackage[pdftex,active,tightpage]{preview}
\setlength\PreviewBorder{2mm}
\usepackage{tikz}
\usepackage{tkz-euclide}
\usetikzlibrary{angles,quotes}
\usetkzobj{all}
\usetikzlibrary{shapes, calc, decorations}
\usepackage{amsmath,amssymb}
\usepackage{helvet}
\usepackage[eulergreek]{sansmath}
\begin{document}
\begin{preview}
\begin{tikzpicture}[very thick,font=\sansmath\sffamily,x=3cm,y=3cm]
\tkzInit[xmax=1.0,ymax=1.0,xmin=-1.0,ymin=-1.0]
\tkzGrid
\tkzAxeXY
\tkzDefPoint(0,0){A}
\tkzDefPoint({cos(FPpi/5)*1},0){B}
\tkzDefPoint({cos(FPpi/5)*1},{sin(FPpi/5)*1}){C}
\tkzDefPoint(1,0){CircleEnd}
\tkzDrawCircle(A,CircleEnd)
% \tkzLabelPoints[below left,font=\sansmath\sffamily](A)
% \tkzLabelPoints[below right,font=\sansmath\sffamily](B)
% Mark angle
\tkzMarkAngle[arc=l,size=0.6cm,fill=green!30](B,A,C)
\tkzLabelAngle[pos=0.15](B,A,C){$\alpha$}
% Draw polygon
\tkzDrawPolygon(A,B,C)
\tkzDrawSegment[black!60!green,very thick](A,B)
\tkzDrawSegment[red,very thick](B,C)
% Label lines
\tkzLabelSegment[above](A,C){$1$}
\tkzLabelSegment[sloped,above=-0.05,red](B,C){$\sin(\alpha)$}
\tkzLabelSegment[below,black!60!green](A,B){$\cos(\alpha)$}
\end{tikzpicture}
\end{preview}
\end{document}
渲染
问题
我不喜欢 x 轴和 y 轴的尖端相距多远。我该如何改变这种情况?
答案1
将选项添加[up space=y,right space=x]
到\tkzAxeXY
。x
和y
应该(显然)是无单位数字,和表示轴线延伸超出最大值的长度(以厘米为单位)。据我了解。
label options
可以使用键修改刻度标签的样式\tkzAxeXY
,因此label options={fill=none}
将删除填充。
手册第 6 节对此进行了记录tkz-base
,宏命令。请注意,这\tkzAxeXY
是四个宏的组合\tkzDrawX\tkzDrawY \tkzLabelX\tkzLabelY
,因此如果您查看第 6 节并找到这四个宏的描述,您就会知道可以为轴使用哪些选项。该手册是法语的,因此了解该语言是一种优势,尽管您可以通过查看示例以及键名称为英语的事实来取得很大进展。(我不懂法语。)
\documentclass[border=4mm]{standalone}
\usepackage{tkz-euclide}
\usetikzlibrary{angles,quotes}
\usetkzobj{all}
\usetikzlibrary{shapes, calc, decorations}
\usepackage{amsmath,amssymb}
\usepackage{helvet}
\usepackage[eulergreek]{sansmath}
\begin{document}
\begin{tikzpicture}[very thick,font=\sansmath\sffamily,x=3cm,y=3cm]
\tkzInit[xmax=1.0,ymax=1.0,xmin=-1.0,ymin=-1.0]
\tkzGrid
\tkzAxeXY[up space=0.2,right space=0.2, label options={fill=none}]
\tkzDefPoint(0,0){A}
\tkzDefPoint({cos(FPpi/5)*1},0){B}
\tkzDefPoint({cos(FPpi/5)*1},{sin(FPpi/5)*1}){C}
\tkzDefPoint(1,0){CircleEnd}
\tkzDrawCircle(A,CircleEnd)
% \tkzLabelPoints[below left,font=\sansmath\sffamily](A)
% \tkzLabelPoints[below right,font=\sansmath\sffamily](B)
% Mark angle
\tkzMarkAngle[arc=l,size=0.6cm,fill=green!30](B,A,C)
\tkzLabelAngle[pos=0.15](B,A,C){$\alpha$}
% Draw polygon
\tkzDrawPolygon(A,B,C)
\tkzDrawSegment[black!60!green,very thick](A,B)
\tkzDrawSegment[red,very thick](B,C)
% Label lines
\tkzLabelSegment[above](A,C){$1$}
\tkzLabelSegment[sloped,above=-0.05,red](B,C){$\sin(\alpha)$}
\tkzLabelSegment[below,black!60!green](A,B){$\cos(\alpha)$}
\end{tikzpicture}
\end{document}
答案2
仅需tikz
\documentclass[border=2mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{angles,quotes}
\usetikzlibrary{shapes, calc, decorations}
\usepackage{amsmath,amssymb}
\usepackage{helvet}
\usepackage[eulergreek]{sansmath}
\begin{document}
\begin{tikzpicture}[very thick,font=\sansmath\sffamily,x=3cm,y=3cm]
\coordinate[label={below left:0}] (A) at (0,0);
\coordinate (B) at (30:1);
\coordinate (c) at (1,0);
\draw [help lines] (-1,-1) grid (1,1);
\draw[-latex] (0,-1) -- (0,1.2)node[left]{$y$};
\path pic[draw=black,fill=green!30, angle radius=10mm,"$\alpha$",angle eccentricity=0.7]
{angle = c--A--B};
\draw (A) -- (B);
\draw[red] (B) -- ($(A)!(B)!(c)$) node[pos=0.5,above=0.13cm,rotate=180,sloped]{$\sin(\alpha)$}
coordinate (C);
\draw[-latex] (-1,0) -- (1.2,0)node[below]{$x$};
\draw[black!60!green] (A) -- (C)node[pos=0.5,below]{$\cos(\alpha)$};
\draw circle (1);
\node [anchor=north east] at (-1,0) {$-1$};
\node [anchor=north west] at (1,0) {$1$};
\node [anchor=north east] at (0,-1) {$-1$};
\node [anchor=south east] at (0,1) {$1$};
\end{tikzpicture}
\end{document}