我需要将“y 标签”向下传递,箭头所在的位置。
此外,橙色节点必须位于箭头上(我做了一个橙色盒子)。
- 最后,我需要标记我所做角度。
我知道这很多,但我真的做不到!我提前表示感谢。
\begin{tikzpicture}[scale=1]
\begin{axis}[
unit vector ratio*= 1 1 1,
axis lines=center,
grid={major},clip=false,
width=20cm,height=15cm,
y axis line style={Stealth-},x axis line style={-Stealth},
xmin=1,xmax=900,
ymax=2,ymin=-2900,
xlabel={$P_{[W]}$},xlabel style={anchor=south west,align=right},
ylabel={$Q_{[VAr]}$},ylabel style={anchor=north east}]
\draw[green,very thick](axis cs:0,0)--(axis cs:631.305,0)node[midway,above]{$P=631,305W$};
\draw[violet,very thick](axis cs:631.305,0)--(axis cs:631.305,-2905.17)node[midway,right]
{$Q=-2905,17VAr$};
\draw[orange,very thick](axis cs:0,0)--(axis cs:631.305,-2905.17)node[midway,above]
{$|S|=2972,972VA$};
\end{axis}
\end{tikzpicture}
答案1
你可以
- 使用
ylabel style={at={(ticklabel cs:0,0)}}
移动 y 标签, - 添加
sloped
节点的斜率, - 使用
angles
角度库。
请注意,我并不是故意这样做的,如果您查看包装上的数量和单位quotes
,这可能是一个好主意。siunitx
\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{arrows.meta,angles}
% \usepackage{siunitx}
\usepackage{pgfplots}
\pgfplotsset{compat=1.17}
\begin{document}
\begin{tikzpicture}[scale=1]
\begin{axis}[
unit vector ratio*= 1 1 1,
axis lines=center,
grid={major},clip=false,
width=20cm,height=15cm,
y axis line style={Stealth-},x axis line style={-Stealth},
xmin=1,xmax=900,
ymax=2,ymin=-2900,
xlabel={$P_{[W]}$},xlabel style={anchor=south west,align=right},
ylabel={$Q_{[VAr]}$},
%ylabel style={anchor=north east},
ylabel style={at={(ticklabel cs:0,0)}}]
\draw[green,very thick](axis cs:0,0) coordinate(O)--(axis cs:631.305,0)
node[midway,above]{$P=631,305W$}
coordinate[pos=1](B);
\draw[violet,very thick](axis cs:631.305,0)--(axis cs:631.305,-2905.17)node[midway,right]
{$Q=-2905,17VAr$};
\draw[orange,very thick](axis cs:0,0)--(axis cs:631.305,-2905.17)
node[midway,above,sloped]
{$|S|=2972,972VA$} coordinate[pos=1](A);
\pic[draw,red,pic text=$\varphi_z$,angle eccentricity=1.5]{angle=A--O--B};
\end{axis}
\end{tikzpicture}
\end{document}