I have the code for a triangle on the Cartesian plane. There seems to be two commands that TikZ
is not able to compile. The first line is \addplot[samples=501,dashed,domain=1:3] {3,x};
which should instruct pgfplots
to draw a vertical line segment for the altitude of the triangle. The second line is \tkzMarkRightAngle(A,P,B);
which should instruct TikZ
to draw the right angle mark at the base of the altitude. (I put a %
in front of these lines so that the code would compile.)
\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=6in,axis equal image,clip=false,
axis lines=middle,
xmin=-3,xmax=5,samples=501,
xlabel=$x$,ylabel=$y$,
ymin=-3,ymax=3,
restrict y to domain=-3:3,
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}
]
\addplot[samples=501,domain=-2:3,blue] {0.4*x + 1.8};
\addplot[samples=501,domain=3:4,blue] {-2*x + 9};
\addplot[samples=501,domain=-2:4,blue] {1};
%\addplot[samples=501,dashed,domain=1:3] {3,x};
\end{axis}
(-2,1)node[label=left:$A$](A){};
(3,3)node[label=above right:$B$](B){};
(4,1)node[label=right:$C$](C){};
(3,1)node(P){};
%\tkzMarkRightAngle(A,P,B);
\end{tikzpicture}
\end{document}
\addplot
line with\draw[dashed] (axis cs:3,1) -- (axis cs:3,3)
.addplopt
command not being compiled? I have used this command in many other diagrams to draw vertical lines.Using the \draw command to plot a vertical line
at this web site. I just posted the code.(6,x)
and{3,x}
. The choice of parentheses vs. braces is significant because it putspgfplots
in different "modes", if you will.