一条线穿过两个三角形的一侧。其中一条线绘制在一个三角形顶点的标签 B' 和 C' 上方。我使用该选项inner sep=2pt
在这些节点周围留出一些空间。不允许留出任何空间。
另外,对于通过 B' 和 C' 绘制的线,我有一对额外的箭头。我知道我有这对箭头用于将域分成两部分并使用选项latex-latex
。如何删除 B' 和 C' 附近的箭头?
\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=-7,xmax=26,
xlabel=$x$,ylabel=$y$,
ymin=-7,ymax=30,
restrict y to domain=-7:30,
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,latex-latex,samples=2,domain=-6:25]{x};
\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]{$C$};
\draw (axis cs:3,9) coordinate(P);
\draw (axis cs:10.5,0) coordinate(b) node[anchor=north, inner sep=2pt]{$B^{\prime}$};
\draw (axis cs:13,5) coordinate(c) node[anchor=south west,inner sep=2pt]{$C^{\prime}$};
\draw (axis cs:9,3) coordinate(p);
\addplot[dashed,latex-latex,samples=2,line width=0.2pt,loosely dash dot,domain=7:10.5]{2 * x - 21};
\addplot[dashed,latex-latex,samples=2,line width=0.2pt,loosely dash dot,domain=13:25]{2 * x - 21};
\addplot[dashed,latex-latex,samples=2,line width=0.2pt,loosely dash dot,domain=-7:25]{0.5 * x + 10.5};
\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);
\end{tikzpicture}
\end{document}
答案1
您可以分别使用B' 和 C' 的north west
和west
锚点来生成一些额外的分离。实际上,默认值比您的情况inner sep
要大(根据 3.0 手册第 229 页,默认情况下是这样的),因此删除该选项会产生额外的空间。2pt
0.3333em
inner sep
对于箭头,原因是您指定了两条具有相同公式但不同域的线。将域组合成一个图会生成一个箭头。
对于箭头,可以通过书写latex-
或来指定箭头应仅位于线的一端,即箭头->线或线->箭头。对于同一图,-latex
无需指定dashed
和。loosely dash dot
\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=-7,xmax=26,
xlabel=$x$,ylabel=$y$,
ymin=-7,ymax=30,
restrict y to domain=-7:30,
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,latex-latex,samples=2,domain=-6:25]{x};
\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]{$C$};
\draw (axis cs:3,9) coordinate(P);
\draw (axis cs:10.5,0) coordinate(b) node[anchor=north west]{$B^{\prime}$};
\draw (axis cs:13,5) coordinate(c) node[anchor=west]{$C^{\prime}$};
\draw (axis cs:9,3) coordinate(p);
\addplot[latex-,samples=2,line width=0.2pt,loosely dash dot,domain=7:10.5]{2 * x - 21};
\addplot[-latex,samples=2,line width=0.2pt,loosely dash dot,domain=13:25]{2 * x - 21};
\addplot[latex-latex,samples=2,line width=0.2pt,loosely dash dot,domain=-7:25]{0.5 * x + 10.5};
\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);
\end{tikzpicture}
\end{document}