我只想将 $v_m\pahse{j-45}$ 的标签移至箭头下方,有什么想法可以实现吗?
\documentclass[12pt, margin=3mm]{standalone}
\usepackage{tikz}
\usepackage{steinmetz}
\usetikzlibrary{angles, arrows.meta, % new
quotes} % new
\definecolor{lava}{rgb}{0.81, 0.06, 0.13}
\definecolor{myblue}{rgb}{0.0, 0.30, 0.60}
%\usepackage{gensymb} % better is to use siunitx
\begin{document}
\begin{tikzpicture}[
ang/.style = {draw, Straight Barb-Straight Barb, anchor=west,
angle radius = 8mm, angle eccentricity=1},
arr/.style = {cap=round,-Straight Barb},
dot/.style = {circle, fill, minimum size=3pt,inner sep=0pt},
every edge quotes/.style = {auto, font=\footnotesize, sloped},
every label/.style = {inner sep=1pt},
]
% axis
\draw[arr] (-2.7,0)--(3.6,0) node[below] {$\Re$}; % x axis
\draw[arr] (0,-2.7)--(0,3.6) node[left] {$\Im$}; % y axis
% circle
\draw (0,0) circle (3.25cm);
% defining radius points
\node (n1) [dot,] at (-45:3.25) {};
\node (n2) [dot,] at (45:3.25) {};
\node (n3) [dot,] at ( 0:3.25) {};
% vector
\coordinate (O) at (0,0);
\path[draw=black, ultra thick, arr]
(O) to ["$\,\,\quad \quad V_m\mathrm{e}^{j(45^{\circ})}$"] (n2.center);
\path[draw=lava, ultra thick, arr]
(O) to ["$\,\,\quad \quad V_m\mathrm{e}^{j(-45^{\circ})}$"] (n1.center);
\path[draw=myblue, ultra thick, arr]
(O) to ["$\,\,\,\,\,\,\,\,\,\,\,\,\,\,\quad V_m\mathrm{e}^{j(0^{\circ})}$"] (n3.center);
% angle
\pic [ang, "$45^{\circ}$"] {angle = n3--O--n2};
\pic [ang, "$-45^{\circ}$"] {angle = n1--O--n3};
\end{tikzpicture}
\end{document}
答案1
您正在使用钛合金 quotes
图书馆。查看第 254 页钛合金手册上我们看到:
一旦加载,在节点命令的选项中,您还可以提供以下形式的字符串:“⟨text⟩”⟨options⟩
因此,您需要做的就是将单词“below”添加到节点规范中。这将产生:
我还擅自将\,\,\,\,\,\,\,\,\,\,\,\,\,\,\quad
MWE 中的 替换为above right
。以下是更新后的代码:
\documentclass[12pt, margin=3mm]{standalone}
\usepackage{tikz}
\usepackage{steinmetz}
\usetikzlibrary{angles, arrows.meta, % new
quotes} % new
\definecolor{lava}{rgb}{0.81, 0.06, 0.13}
\definecolor{myblue}{rgb}{0.0, 0.30, 0.60}
\begin{document}
\begin{tikzpicture}[
ang/.style = {draw, Straight Barb-Straight Barb, anchor=west,
angle radius = 8mm, angle eccentricity=1},
arr/.style = {cap=round,-Straight Barb},
dot/.style = {circle, fill, minimum size=3pt,inner sep=0pt},
every edge quotes/.style = {auto, font=\footnotesize, sloped},
every label/.style = {inner sep=1pt},
]
% axis
\draw[arr] (-2.7,0)--(3.6,0) node[below] {$\Re$}; % x axis
\draw[arr] (0,-2.7)--(0,3.6) node[left] {$\Im$}; % y axis
% circle
\draw (0,0) circle (3.25cm);
% defining radius points
\node (n1) [dot,] at (-45:3.25) {};
\node (n2) [dot,] at (45:3.25) {};
\node (n3) [dot,] at ( 0:3.25) {};
% vector
\coordinate (O) at (0,0);
\path[draw=black, ultra thick, arr]
(O) to ["$\,\,\quad \quad V_m\mathrm{e}^{j(45^{\circ})}$"] (n2.center);
\path[draw=lava, ultra thick, arr]
(O) to ["$\,\,\quad \quad V_m\mathrm{e}^{j(-45^{\circ})}$" below] (n1.center);
\path[draw=myblue, ultra thick, arr]
(O) to ["$V_m\mathrm{e}^{j(0^{\circ})}$" above right] (n3.center);
% angle
\pic [ang, "$45^{\circ}$"] {angle = n3--O--n2};
\pic [ang, "$-45^{\circ}$"] {angle = n1--O--n3};
\end{tikzpicture}
\end{document}
答案2
答案3
还有一个解决方案,使用quote
语法将标签定位在路径的所需侧(在您的情况下为矢量)并siunitx
写入角度值:
\documentclass[12pt, margin=3mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{angles, arrows.meta,
quotes}
\definecolor{lava}{rgb}{0.81, 0.06, 0.13}
\definecolor{myblue}{rgb}{0.0, 0.30, 0.60}
\usepackage{steinmetz}
\usepackage{siunitx} % new
\begin{document}
\begin{tikzpicture}[
ang/.style = {draw, Straight Barb-Straight Barb, anchor=west,
angle radius = 8mm, angle eccentricity=1,
font=\footnotesize}, % <--- added
arr/.style = {cap=round,-Straight Barb},
dot/.style = {circle, fill, minimum size=3pt,inner sep=0pt},
every edge quotes/.style = {auto, font=\footnotesize, sloped},
every label/.style = {inner sep=1pt},
]
% axis
\draw[arr] (-3.4,0)--(3.6,0) node[below] {$\Re$}; % changed
\draw[arr] (0,-3.4)--(0,3.6) node[left] {$\Im$}; % changed
% circle
\draw (0,0) circle (3.25cm);
% defining radius points
\node (n1) [dot,] at (-45:3.25) {};
\node (n2) [dot,] at ( 45:3.25) {};
\node (n3) [dot,] at ( 0:3.25) {};
% vector
\coordinate (O) at (0,0);
\path[draw=black, ultra thick, arr]
(O) to ["$V_m\mathrm{e}^{j(\SI{45}{\degree})}$"] (n2.center);
\path[draw=lava, ultra thick, arr]
(O) to ["$V_m\mathrm{e}^{j(\SI{-45}{\degree})}$" '] (n1.center); % <--- observe added '
\path[draw=myblue, ultra thick, arr]
(O) to [pos=0.7,"$ V_m\mathrm{e}^{j(\SI{0}{\degree})}$" ] (n3.center);
% angle
\pic [ang, "\SI{45}{\degree}"] {angle = n3--O--n2};
\pic [ang, "\SI{-45}{\degree}"] {angle = n1--O--n3};
\end{tikzpicture}
\end{document}
编辑: 与您的 MWE 相比,上述 MWE 有以下变化:
- 标签的定位使用缩写
'
选项swap
,将标签推到向量的另一侧:
(O) to ["$V_m\mathrm{e}^{j(\SI{-45}{\degree})}$" swap]
或略短
(O) to ["$V_m\mathrm{e}^{j(\SI{-45}{\degree})}$" ']
- 轴延长到可以穿过圆
- 标签定位使用选项
pos=...
,可以将标签的位置从路径中间移动到路径上的所需点 - 为了更好地阅读,角度标签减少到
\footnotesize