# Specifying some points in rectangular coordinates and other points in polar coordinates

I would like to draw a right triangle inscribed in a circle on the Cartesian plane. In the following code, a circle of radius 3 and center (1,1) is drawn. One side of the triangle, the hypotenuse, is drawn - it is the diameter through (1,1) that is vertical. The endpoints of this diameter are two vertices of the triangle; they are labeled A and C. I would like to specify B using polar coordinates - with an angle measure of -135 degrees or -150 degrees. (I did not specify the coordinates of B in rectangular coordinates. So, no triangle is drawn by the following code.)

There is one other modification to the display that I would like. Vertical line \ell should be drawn in light blue, light green, or light gray. I remember seeing an option for help lines in the manual. Would this draw \ell the way I want it drawn?

\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=3in,axis equal image,clip=false,
axis lines=middle,
xmin=-3,xmax=5,
xlabel=$x$,ylabel=$y$,
ymin=-5,ymax=5,
restrict y to domain=-5:5,
enlargelimits={abs=0.25cm},
axis line style={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 (1,1) circle (3);
\draw [fill] (1,1) circle [radius=1.5pt] node[anchor=west,font=\tiny]{$(1, \, 1)$};
\addplot [dashed,latex-latex,line width=0.5\pgflinewidth,domain=-5:5] (1,x) node [pos=0.1, anchor=north west, font=\footnotesize] {$\ell$};

\draw (axis cs:1,4) coordinate(A) node[above right]{$A$};
%\draw (axis cs:) coordinate(B) node[above left]{$B$};
\draw (axis cs:1,-2) coordinate(C) node[below right]{$C$};

\end{axis}

%\draw[blue] (A) -- (B) -- (C) -- cycle;
%\tkzMarkRightAngle(A,B,C);

\end{tikzpicture}

\end{document}

• You mean you want to specify the rotation of B around the center of the circle don't you? (so that there is a right angle at <ABC) – Thruston Feb 5 '15 at 22:52
• Yes. B is a point on the circle. With respect to coordinate axes intersecting at (1,1), B should be rotated 110 degrees. – Adelyn Feb 6 '15 at 14:30
• Your graph is nice, but I want the code that I posted to be used with the modifications needed to plot B. – Adelyn Feb 6 '15 at 14:32

with tikz

\documentclass[tikz]{standalone}
%\usetikzlibrary{calc}
\def\ang{60}
\def\mypoint{3}
\begin{document}
\begin{tikzpicture}
\draw[latex-latex,thick,gray!50] (-5,0) -- (5,0)node[right]{$x$};
\draw[latex-latex,thick, gray!50] (0,-5) -- (0,5)node[above]{$y$};
\begin{scope}[shift={(1,1)}]
\draw (0,0)node[circle,inner sep=2pt, fill](o){} circle (\radius);
\draw [dashed,latex-latex,blue] (0,5) -- node [pos=0.9, anchor=north west, font=\footnotesize] {$\ell$}
(0,-5);
\coordinate [label=above right:A] (A) at (\ang:\radius);
\coordinate [label=below left:C] (C) at (180+\ang:\radius);
\coordinate [label=above left:B] (B)  at (\mypoint*\ang:\radius);
\draw[blue] (A) -- (B) -- (C) -- cycle;
\end{scope}
\end{tikzpicture}
\end{document} And more versatile tkz-euclide

\documentclass[11pt,a4paper,svgnames,usenames,dvipsnames]{article}
\usepackage{tkz-euclide}
\usetkzobj{all}

\begin{document}
\begin{tikzpicture}
\tkzDefPoint(3,-4){A}\tkzDefPoint(8,4){B}\tkzDefPoint(1,5){C}
\tkzDefMidPoint(A,B) \tkzGetPoint{O}
\tkzInterLC(C,A)(O,A) \tkzGetSecondPoint{M}
\tkzInterLC(C,B)(O,A) \tkzGetFirstPoint{N}
\tkzInterLL(B,M)(A,N) \tkzGetPoint{I}
\tkzDrawCircle[diameter](A,B)
\tkzDrawSegments(A,M B,N A,B B,M A,N)
\tkzMarkRightAngles[fill=Maroon!20](A,M,B A,N,B)
\tkzLabelPoints[below](O,A,B)
\tkzLabelPoint[above left](M){$M$}
\tkzLabelPoint[above](N){$N$}
\tkzDrawPoints[color=Maroon](O,A,B)
\end{tikzpicture}
\end{document} Here is the version retaining axis environment:

\documentclass[10pt]{amsart}
\usepackage{tkz-euclide}
\usetkzobj{all}
\usepackage{pgfplots}
\pgfplotsset{compat=1.11}

\begin{document}

\begin{tikzpicture}
\begin{axis}[axis equal,
axis lines=middle,
xmin=-3,xmax=5,
xlabel=$x$,ylabel=$y$,
ymin=-5,ymax=5,
enlargelimits={abs=0.25cm},
axis line style={draw=gray!30,latex-latex},
xtick={\empty},ytick={\empty},
xlabel style={at={(ticklabel* cs:1)},anchor=north west},
ylabel style={at={(ticklabel* cs:1)},anchor=south west}
]
\addplot [dashed,latex-latex,line width=0.5\pgflinewidth,domain=-5:5] (1,x) node [pos=0.1, anchor=north west, font=\footnotesize] {$\ell$};

%\draw (1,3) coordinate(A) node[above right]{$A$};
%\draw (axis cs:) coordinate(B) node[above left]{$B$};
%\draw (1,-2) coordinate(C) node[below right]{$C$};

\begin{scope}[yshift=5mm,font=\footnotesize]
\draw (1,0) circle (1.5cm);
\path (1,0) -- +(80:1.5cm) coordinate(A) node[above]{$A$};
\path (1,0) -- +(260:1.5cm) coordinate(C) node[below]{$C$};
\draw [fill] (1,0) circle [radius=1.5pt] node[anchor=west,font=\tiny]{$(1, \, 1)$};
\path (1,0) -- +(135:1.5cm) coordinate(B) node[inner sep=2pt,above left]{$B$};
\draw[blue] (A) -- (B) -- (C) -- cycle;
\end{scope}
\end{axis}
\tkzMarkRightAngle(A,B,C);
\end{tikzpicture}

\end{document} • I like your graphs. I want the code to include the code that I posted in order to maintain consistency with the codes for other graphs that I have in a file. In particular, I want to keep the axis environment and use TikZ. (I do like that your lines for the axes are light grey.) – Adelyn Feb 6 '15 at 15:42
• @Adelyn Sure, but time to go to bed now for me. Tomorrow I will update. – user11232 Feb 6 '15 at 15:46
• Can you find time today to send me the code? I want the code to include the code that I posted in order to maintain consistency with the codes for other graphs that I have in a file. In particular, I want to keep the axis environment and to use TikZ. (I do like that your lines for the axes are light grey, though.) – Adelyn Feb 9 '15 at 16:14
• @Adelyn I have updated the answer. – user11232 Feb 10 '15 at 0:16
• The display is exactly what I want! (The display of the axes is nice.) The code is almost what I want. The only modification I would like is to put the radius measurement in terms of the coordinate system, using the axis environment, instead of in terms of the metric system. – Adelyn Feb 10 '15 at 0:45

While you are waiting for an answer about how to define a point on your circle in pgf here is a version in Metapost showing you one way to define points on the circumference of a circle. prologues := 3;
outputtemplate := "%j%c.eps";
newinternal degrees;
degrees := 1/45;

beginfig(1);

u = 1cm;

% axes
path xx, yy;
xx = (left -- right) scaled 5u;
yy = (down -- up)    scaled 5u;
drawarrow xx withcolor .7 white;
drawarrow yy withcolor .7 white;
label.rt (btex $x$ etex, point 1 of xx);
label.top(btex $y$ etex, point 1 of yy);

% circle and points and line
path C;
C = fullcircle scaled 6u shifted (1u,1u);

pair a, b, c;
a = point   80 degrees of C;
c = point -100 degrees of C;
b = point  140 degrees of C;

path ell;
ell = yy shifted (xpart center C,0);

% draw the dashed line
draw ell dashed evenly withcolor 0.8[blue,white];

% mark the right angle
draw unitsquare scaled 5 rotated angle (c-b) shifted b withcolor .7 white;

% draw the triangle
draw a -- b -- c -- cycle withcolor .67 blue;

% draw the circle (and center dot) on top
draw C; fill fullcircle scaled 3 shifted center C;

% finally label the points
label(btex $A$ etex, 1.1[center C, a]);
label(btex $C$ etex, 1.1[center C, c]);
label(btex $B$ etex, 1.1[center C, b]);
label.rt(btex $\ell$ etex, point 0.1 of ell);

endfig;
end.

• @PaulGessler Paul, can you give me the code for plotting the vertics of a triangle inscribed on a circle, not centered at the origin? I want to use the axis environment that I provided, which is similar to the way you used the axis environment from our previous discussion. Here, I need to specify points in polar coordinates ... but there is a shift of the center of the circle. – Adelyn Feb 10 '15 at 16:08
• @PaulGessler The code provided by Harish may be of help. The only modification that I would like is to put the radius measurement in terms of the coordinate system, using the axis environment, instead of in terms of the metric system. – Adelyn Feb 10 '15 at 16:12

You can use normal TikZ coordinate specifications including polar coordinates inside an axis environment by setting disabledatascaling. Note that this will only work if the range of your data isn't too large. \documentclass[10pt]{amsart}
\usepackage{pgfplots}
\pgfplotsset{compat=1.11}

\begin{document}

\begin{tikzpicture}
\begin{axis}[width=3in,axis equal image,clip=false,
axis lines=middle,
xmin=-3,xmax=5,
xlabel=$x$,ylabel=$y$,
ymin=-5,ymax=5,
restrict y to domain=-5:5,
enlargelimits={abs=0.25cm},
axis line style={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},
disabledatascaling
]

\draw (1,1) circle (3);
\draw [fill] (1,1) circle [radius=1.5pt] node[anchor=west,font=\tiny]{$(1, \, 1)$};
\addplot [densely dashed,latex-latex, blue!50,domain=-5:5] (1,x) node [pos=0.1, anchor=north west, font=\footnotesize] {$\ell$};

\draw (axis cs:1,4) coordinate(A) node[above right]{$A$};
\draw (axis cs:1,1) ++(-135:3) coordinate(B) node[below left]{$B$};
\draw (axis cs:1,-2) coordinate(C) node[below right]{$C$};

\draw [ultra thick, red, opacity=0.55, line join=round] (A) -- (B) -- (C) -- cycle;

\end{axis}
\end{tikzpicture}

\end{document}