I have a display of two triangles, but the triangle drawn in red is unintentional. TikZ
is misinterpreting the coordinates for point C
. The polar coordinates for C
is given as \coordinate (C) at (120:5);
. TikZ
is plotting the point in Quadrant III.
Also, TikZ
is misinterpreting the positions at which I want the label for the vertex A
and the labels for the angles to be typeset. The command to place A
is
\node at ({2.5mm*sqrt(2)/2},{-2.5mm*sqrt(2)/2}){$A$};
and the commands to place $\theta$
are
\coordinate (label_for_theta) at (60:4mm);
\node[font=\footnotesize] at (label_for_theta){$\theta$};
.
It seems to me that TikZ
is placing these labels using the canvas coordinate system.
\documentclass{amsart}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{tikz}
\usetikzlibrary{calc,angles,positioning,intersections,quotes,decorations.markings,backgrounds,patterns}
\usepackage{pgfplots}
\pgfplotsset{compat=1.11}
\begin{document}
\begin{tikzpicture}
\begin{axis}[width=5in,axis equal image,
axis lines=middle,
xmin=-5,xmax=5,
ymin=-1.5,ymax=5,
restrict y to domain=-1.5:5,
enlargelimits={abs=0.5cm},
xtick={\empty},ytick={\empty},
axis line style={latex-latex},
xlabel=$x$,ylabel=$y$,
xlabel style={at={(ticklabel* cs:1)},anchor=north west},
ylabel style={at={(ticklabel* cs:1)},anchor=south west}
]
%A triangle is drawn on the Cartesian plane. One side of the triangle is along
%the positive x-axis, and another side of the triangle is drawn in Quadrant II.
\coordinate (A) at (0,0);
\coordinate (B) at (3.5,0);
\coordinate (C) at (120:5);
\draw[red] (A) -- (B) -- (C) -- cycle;
%The labels for A and B are typeset.
\node at ({2.5mm*sqrt(2)/2}:{-2.5mm*sqrt(2)/2}){$A$};
\node at (3.5,-2.5mm){$B$};
%The point C' = C is placed using Cartesian coordinates.
\coordinate (C') at (-2.5,{5*sin(120)});
\draw[fill] (C') circle (1.5pt);
\draw (A) -- (C');
\draw (B) -- (C');
%The label for C' = C is typeset.
\coordinate (label_C_left) at ($(C')!-4mm!(B)$);
\coordinate (label_C_right) at ($(C')!-4mm!(A)$);
\coordinate (label_C) at ($(label_C_left)!0.5!(label_C_right)$);
\node[blue] at ($(C')!2.5mm!(label_C)$){$C$};
%Angles are drawn for $\theta$ and its supplement.
\draw[draw=blue] (A) ++(120:4mm) arc (120:0:4mm);
\coordinate (label_for_theta) at (60:6.5mm);
\node[font=\footnotesize] at (label_for_theta){$\theta$};
\draw[draw=blue,dash dot] (A) ++(180:6mm) arc (180:120:6mm);
\coordinate (label_for_supplement_to_theta) at (150:8.5mm);
\node[font=\footnotesize] at (label_for_supplement_to_theta){$\pi - \theta$};
%A right-angle mark is drawn.
\coordinate (U) at ($(-2.5,0)!3mm!45:(A)$);
\draw[dash dot] (U) -- ($(-2.5,0)!(U)!(A)$);
\draw[dash dot] (U) -- ($(-2.5,0)!(U)!(C')$);
\draw[dashed] (C') -- (-2.5,0);
%Braces indicating the distances that C' is from the axes are typeset. To give
%them the appearance of being typeset over the axes, they are first typeset
%in white with a line width of 2pt, which is 10 times the thickness of the
%brace that is actually typeset.
\draw[draw=white,line width=4pt,decorate,decoration={brace,raise=5pt,amplitude=5pt}] (-2.5,0) -- (C');
\draw[decorate,decoration={brace,raise=5pt,amplitude=5pt}] (-2.5,0) -- (C');
\draw[draw=white,line width=4pt,decorate,decoration={brace,raise=5pt,amplitude=5pt,mirror}] (-2.5,0) -- (A);
\draw[decorate,decoration={brace,raise=5pt,amplitude=5pt,mirror}] (-2.5,0) -- (A);
\coordinate (label_for_5_sin_theta) at ($({5*cos(120)},{2.5*sin(120)}) + (-2.5mm-10pt,0pt)$);
\node[anchor=east] at (label_for_5_sin_theta){$r\sin\theta$};
\coordinate (label_for_5_cos_theta) at (-1.25,-2.5mm-10pt);
\node at (label_for_5_cos_theta){$r\cos\theta$};
\end{axis}
\end{tikzpicture}
\end{document}
C
there with the command\coordinate (C') at (-2.5,{5*sin(120)});
.A
,\theta
, and\pi - \theta
are obviously in the wrong place. Also, the command\draw[red] (A) -- (B) -- (C) -- cycle;
should draw a triangle in Quadrant III. It does when my computer compiles the code.