从直角坐标转换为极坐标

从直角坐标转换为极坐标

以下代码给出了我想要的显示。我想要的唯一修改是在极坐标中指定具有相同半径的点。(这些点位于以 (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}

相关内容