![从直角坐标转换为极坐标](https://linux22.com/image/305337/%E4%BB%8E%E7%9B%B4%E8%A7%92%E5%9D%90%E6%A0%87%E8%BD%AC%E6%8D%A2%E4%B8%BA%E6%9E%81%E5%9D%90%E6%A0%87.png)
以下代码给出了我想要的显示。我想要的唯一修改是在极坐标中指定具有相同半径的点。(这些点位于以 (0,1) 为中心的单位圆上。在极坐标中,A
是和的矢量(1:72)=(1:pi/5)
和(0,1)
,B
是和的矢量(1:144)=(1:2pi/5)
和(0,1)
,C
是和的矢量(1:288)=(1:4pi5)
和(0,1)
。)我想使用TikZ
环境来执行计算以精确放置点。
\documentclass[10pt]{amsart}
\usepackage{tikz}
\usetikzlibrary{calc,angles,positioning,intersections,quotes,decorations.markings}
\usepackage{mathtools,systeme,array}
\usepackage{tkz-euclide}
\usetkzobj{all}
\usepackage{pgfplots}
\pgfplotsset{compat=1.11}
\begin{document}
\begin{tikzpicture}
\begin{axis}[width=4in,axis equal image,clip=false,
axis lines=middle,
xmin=-1.5,xmax=1.5,samples=501,
xlabel=$x$,ylabel=$y$,
ymin=-0.5,ymax=2.5,
restrict y to domain=-0.5:2.5,
enlargelimits={abs=0.25cm},
axis line style={draw=gray!30,latex-latex},
ticklabel style={font=\tiny,fill=white},
xtick={\empty},ytick={\empty},
xlabel style={at={(ticklabel* cs:1)},anchor=north west},
ylabel style={at={(ticklabel* cs:1)},anchor=south west}
]
\draw (axis cs:0.309016994375,1.951056516295) coordinate(A) node[above right]{$A$};
\draw (axis cs:-0.809016994375,1.587785252292) coordinate(B) node[above]{$B$};
\draw (axis cs:0.309016994375, 0.048943483705) coordinate(C) node[below]{$C$};
\draw (0,1) circle (1);
\end{axis}
\draw (A) -- (B) -- (C) -- cycle;
\end{tikzpicture}
\end{document}
答案1
一种方法是绘制圆和线,并使用 的参数坐标\addplot
。您的圆和三角形将变成
\addplot [samples=200,domain=0:360] ({cos(x)},{1+sin(x)});
\addplot [samples at={72,144,288,72}] ({cos(x)},{1+sin(x)});
可以添加点的标签,例如
\node at ({cos(72)},{1+sin(72)}) [above right] {$A$};
\documentclass{amsart}
\usepackage{pgfplots}
\pgfplotsset{compat=1.11}
\begin{document}
\begin{tikzpicture}
\begin{axis}[width=4in,axis equal image,clip=false,
axis lines=middle,
xmin=-1.5,xmax=1.5,samples=501,
xlabel=$x$,ylabel=$y$,
ymin=-0.5,ymax=2.5,
restrict y to domain=-0.5:2.5,
enlargelimits={abs=0.25cm},
axis line style={draw=gray!30,latex-latex},
ticklabel style={font=\tiny,fill=white},
xtick={\empty},ytick={\empty},
xlabel style={at={(ticklabel* cs:1)},anchor=north west},
ylabel style={at={(ticklabel* cs:1)},anchor=south west},
]
\addplot [samples=200,domain=0:360] ({cos(x)},{1+sin(x)});
\addplot [samples at={72,144,288,72}] ({cos(x)},{1+sin(x)});
\node at ({cos(72)},{1+sin(72)}) [above right] {$A$};
\node at ({cos(144)},{1+sin(144)}) [above left] {$B$};
\node at ({cos(288)},{1+sin(288)}) [below] {$C$};
\end{axis}
\end{tikzpicture}
\end{document}