我经常需要画相位图。以下是 2D 情况的示例:
\documentclass{article}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage{tikz}
\usetikzlibrary{calc, hobby}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{plotmarks}
\tikzset{tangent/.style = {
in angle={(180+#1)},
Hobby finish,
designated Hobby path=next,
out angle={(#1)}
}}
\begin{document}
\begin{figure}[htbp]
\centering
\begin{tikzpicture}
\coordinate (fpcrit) at (0, 0);
\coordinate (lam0v0) at (1, -4);
\coordinate (lam0v1) at (-1, 4);
\coordinate (lam1v0) at (1, 1);
\coordinate(lam1v1) at (-1, -1);
\coordinate (l0sp) at (1, -3.5);
\coordinate (l0ep) at (1, 0.8);
\coordinate (l0csp) at (0.3, -0.5);
\coordinate (l0cep) at (0, -0.2);
%========================================
\draw[thick, decoration={markings, mark=at position 0.5 with {\arrow[scale=1.5]{>}}},
postaction={decorate}] (lam0v0) to (fpcrit);
\draw[thick, decoration={markings, mark=at position 0.5 with {\arrow[scale=1.5]{>}}},
postaction={decorate}] (lam0v1) to (fpcrit);
\draw[thick, decoration={markings, mark=at position 0.5 with {\arrow[scale=1.5]{>}}},
postaction={decorate}] (fpcrit) to (lam1v1);
\draw[decoration={markings, mark=at position 0.5 with {\arrow[scale=1.5]{>}}}, postaction={decorate}] (l0sp) .. controls (l0csp) and (l0cep).. (l0ep);
%========================================
\draw[thick, decoration={markings, mark=at position 0.5 with {\arrow[scale=1.5]{>}}},
postaction={decorate}] (fpcrit) to (lam1v0);
\draw[thick, decoration={markings, mark=at position 0.5 with {\arrow[scale=1.5]{>}}},
postaction={decorate}] (fpcrit) to (lam1v1);
\node [scale=1.5]at (fpcrit) {\pgfuseplotmark{o}};
\end{tikzpicture}
\end{figure}
\end{document}
绘制特征向量很容易,我认为我无法进一步改进我的绘制方法。
不过,我想提请大家注意我是如何绘制曲线的。基本上,我是通过反复试验来确定起点、终点和控制点(分别为..sp
、)。选择控制点是为了使曲线与绘制的特征向量相切。反复试验非常耗时。..ep
..cp..
我有一个改进方法:创建“标准”相图(特征向量沿 x 轴和 y 轴),然后我可以根据需要旋转和“挤压”相图以生成“特定”相图,因为基本上相图都是“标准”相图的“旋转 + 挤压”?我用 Paint 来说明:
实现这一目标的好方法是什么?
或者,有没有一种我根本没想到的更聪明的方法?也许是时候让我更多地使用 Lua 或 Python 了?
答案1
一个选项是对整个环境使用坐标变换tikzpicture
。这将保留任何文本或箭头装饰的纵横比;它只影响路径绘制命令。
将所有内容打包在一个命令中只是为了举例;当然,在实际使用中,您会在每个阶段画像上放置不同的东西。
\documentclass[tikz]{standalone}
\newcommand{\skewedphase}[1][]{%
\begin{tikzpicture}[#1]
\draw (-1,0) -- (1,0) (0,-1) -- (0,1);
\draw[domain=0.1:1] plot (\x,0.1/\x);
\draw (0,0) circle (1.5pt);
\draw[->] (0,0) -- (0.5,0);
\draw[->] (0,0) -- (0,0.5);
\end{tikzpicture}
}
\begin{document}
\skewedphase
\skewedphase[x={(1cm,0cm)},y={(0cm,1cm)}] % same as the default
\skewedphase[x={(0.710cm,0.410cm)},y={(0.410cm,0.710cm)}]
\skewedphase[x={(0.710cm,-0.410cm)},y={(-0.410cm,0.710cm)}]
\end{document}