我正在尝试使用 pgfplots 创建一个 tikz 图片,该图片具有 tkz-euclide 包的角度。 然而,经过千辛万苦,我无法编译乳胶文档。
我尝试更改路径内的参数。 似乎什么都不起作用。 去掉kzMarkAnglesize=0.5cm,mark=|;线将允许代码工作,但角度显然不会显示。
\begin{figure}[ht]
\begin{center}
\tikzset{every picture/.style={xscale=1,yscale=1}}
\begin{tikzpicture}
\begin{axis}[
domain=0:8,
xmin=0, xmax=8,
ymin=0, ymax=8,
samples=400,
yticklabels={,,},
xticklabels={,,},
ticks=none,
axis y line=center,
axis x line=middle,
xscale=2, yscale=1.5,
clip=false,
]
\addplot+[thick, smooth, mark=none, color=black, width=0.1in] plot coordinates
{(0,3) (8,7)};
\addplot+[thick, smooth, mark=none, color=black, width=0.1in] plot coordinates
{(6,6) (8,6)};
\path
(8,7)node(A){}
(6,6)node(B){}
(8,6)node(C){};
\tkzMarkAngle[size=0.5cm,mark=|](A,B,C);
\node[label={180:{$\theta_H$}},circle,fill,inner sep=0pt] at (axis cs:0,3) {};
\addplot+[thick, smooth, mark=none, color=black, width=0.1in] plot coordinates
{(0,1) (8,3)};
\node[label={180:{$\theta_L$}},circle,fill,inner sep=0pt] at (axis cs:0,1) {};
\end{axis}
\end{tikzpicture}
\end{center}
\end{figure}
错误:没有已知名为 B 的形状
这是一个最小的工作示例(根据要求):
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{pgfplots}
\pgfplotsset{compat=1.11}
\usepackage{tkz-euclide}
\usepackage{tikz}
\usetkzobj{all}
\begin{document}
\begin{figure}[ht]
\begin{center}
\tikzset{every picture/.style={xscale=1,yscale=1}}
\begin{tikzpicture}
\begin{axis}[
domain=0:8,
xmin=0, xmax=8,
ymin=0, ymax=8,
samples=400,
yticklabels={,,},
xticklabels={,,},
ticks=none,
axis y line=center,
axis x line=middle,
xscale=2, yscale=1.5,
clip=false,
]
\addplot+[thick, smooth, mark=none, color=black, width=0.1in] plot coordinates {(0,3) (8,7)};
\addplot+[thick, smooth, mark=none, color=black, width=0.1in] plot coordinates {(6,6) (8,6)};
\path
(8,7)node(A){}
(6,6)node(B){}
(8,6)node(C){};
\node[label={180:{$\theta_H$}},circle,fill,inner sep=0pt] at (axis cs:0,3) {};
\addplot+[thick, smooth, mark=none, color=black, width=0.1in] plot coordinates {(0,1) (8,3)};
\node[label={180:{$\theta_L$}},circle,fill,inner sep=0pt] at (axis cs:0,1) {};
\end{axis}
\end{tikzpicture}
\end{center}
\end{figure}
\end{document}
两种解决方案。我更喜欢第二个。
解决方案1:
\tikzset{every picture/.style={xscale=1,yscale=1}}
\begin{tikzpicture}
\begin{axis}[
domain=0:8,
xmin=0, xmax=8,
ymin=0, ymax=8,
samples=400,
yticklabels={,,},
xticklabels={,,},
ticks=none,
axis y line=center,
axis x line=middle,
xscale=2, yscale=1.5,
clip=false,
]
\addplot+[thick, smooth, mark=none, color=black, width=0.1in] plot coordinates
{(0,3) (8,7)};
\addplot+[thick, smooth, mark=none, color=black, width=0.1in] plot coordinates
{(6,6) (8,6)};
\coordinate (A) at (axis cs:8,7);
\coordinate (B) at (axis cs:6,6);
\coordinate (C) at (axis cs:8,6);
\path pic[<->,draw=blue, angle radius=15mm, "$\alpha$", angle eccentricity=.8]{angle=C--B--A};
\path pic[<->,draw=red, angle radius=15mm, "$\theta$", angle eccentricity=.8,pic text options={shift={(10mm,15mm)}}]{angle=A--B--C};
\node[label={180:{$\theta_H$}},circle,fill,inner sep=0pt] at (axis cs:0,3) {};
\addplot+[thick, smooth, mark=none, color=black, width=0.1in] plot coordinates
{(0,1) (8,3)};
\node[label={180:{$\theta_L$}},circle,fill,inner sep=0pt] at (axis cs:0,1) {};
\end{axis}
\end{tikzpicture}
解决方案2:
\begin{tikzpicture}[x=0.5cm,y=0.5cm]
\coordinate (A) at (8,7);
\coordinate (B) at (6,6);
\coordinate (C) at (8,6);
\draw[-latex](-0.2,0)--++(9,0)node[below]{$x$};
\draw[-latex](0,-0.2)--++(0,9)node[left]{$y$};
\draw[very thick] (0,3)--(A)node[pos=0,left]{$\theta_H$};
\draw[very thick] (0,1)--(8,3)node[pos=0,left]{$\theta_L$};
\draw[] (B)--(C);
\path pic[<->,draw=blue,blue ,angle radius=8mm, "$\alpha$", angle eccentricity=1.3]{angle=C--B--A};
\path pic[<->,draw=red, angle radius=5mm, "$\theta$", angle eccentricity=1.0,pic text options={shift={(5mm,8mm)}}]{angle=A--B--C};
\end{tikzpicture}