未绘制线

未绘制线

我有一个三角形及其沿直线 y=x 的反射图。代码未编译,因为绘制直线 y=x 的命令中有错误。这是命令。

\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}

\setlength{\oddsidemargin}{0.0in}
\setlength{\evensidemargin}{0.0in} \setlength{\textwidth}{6.1in}
\setlength{\topmargin}{0.0in} \setlength{\textheight}{9in}


\begin{document}
\begin{tikzpicture}
\begin{axis}[width=4in,axis equal image,clip=false,
axis lines=middle,
xmin=-5,xmax=15,
xlabel=$x$,ylabel=$y$,
ymin=-4,ymax=14,
restrict y to domain=-4:14,
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 (axis cs:-3,-3) coordinate(A) node[above left]{$A$};
\draw (axis cs:0,10.5) coordinate(B) node[above left]{$B$};
\draw (axis cs:5,13) coordinate(C) node[above right]{$C$};
\draw (axis cs:3,9) coordinate(P);

\draw (axis cs:10.5,0) coordinate(b) node[below]{$B^{\prime}$};
\draw (axis cs:13,5) coordinate(c) node[above right]{$C^{\prime}$};
\draw (axis cs:9,3) coordinate(p);
\end{axis}

\draw (A) -- (B) -- (C) -- cycle;
\draw[dashed] (B) -- (P);
\tkzMarkRightAngle(A,P,B);

\draw[dashed] (A) -- (b) -- (c) -- cycle;
\draw[dotted] (b) -- (p);
\tkzMarkRightAngle[densely dotted](A,p,b);

%\addplot[dashed,samples=2,domain=-4:14]{x};
\end{tikzpicture}

\end{document}

答案1

添加

\addplot[dashed,samples=2,domain=-4:14]{x};

在你的代码中里面环境axis

\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}

\setlength{\oddsidemargin}{0.0in}
\setlength{\evensidemargin}{0.0in} \setlength{\textwidth}{6.1in}
\setlength{\topmargin}{0.0in} \setlength{\textheight}{9in}


\begin{document}
\begin{tikzpicture}
\begin{axis}[width=4in,axis equal image,clip=false,
axis lines=middle,
xmin=-5,xmax=15,
xlabel=$x$,ylabel=$y$,
ymin=-4,ymax=14,
restrict y to domain=-4:14,
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[dashed,samples=2,domain=-4:14]{x};                             %% here
\draw (axis cs:-3,-3) coordinate(A) node[above left]{$A$};
\draw (axis cs:0,10.5) coordinate(B) node[above left]{$B$};
\draw (axis cs:5,13) coordinate(C) node[above right]{$C$};
\draw (axis cs:3,9) coordinate(P);

\draw (axis cs:10.5,0) coordinate(b) node[below]{$B^{\prime}$};
\draw (axis cs:13,5) coordinate(c) node[above right]{$C^{\prime}$};
\draw (axis cs:9,3) coordinate(p);
\end{axis}

\draw (A) -- (B) -- (C) -- cycle;
\draw[dashed] (B) -- (P);
\tkzMarkRightAngle(A,P,B);

\draw[dashed] (A) -- (b) -- (c) -- cycle;
\draw[dotted] (b) -- (p);
\tkzMarkRightAngle[densely dotted](A,p,b);

%\addplot[dashed,samples=2,domain=-4:14]{x};
\end{tikzpicture}

\end{document}

在此处输入图片描述

相关内容