我正在使用这个答案。
请注意,每个相图的创建方式如下,
\newinlay\saddle{saddle}%
{\begin{tikzpicture}[scale=\inlayscale]
\foreach \sx in {+,-}
{\draw[flow] (\sx4,0) -- (0,0);
\draw[flow] (0,0) -- (0,\sx4);
\foreach \sy in {+,-}
\foreach \a/\b/\c/\d in {2.8/0.3/0.7/0.6,3.9/0.4/1.3/1.1}
\draw[flow] (\sx\a,\sy\b)
.. controls (\sx\c,\sy\d) and (\sx\d,\sy\c)
.. (\sx\b,\sy\a);
}
完整代码如下
% Poincaré Diagram: Classification of Phase Portaits in the (det A,Tr A)-plane
% Author: Gernot Salzer
% Based on a drawing by Douglas R. Hundley, people.whitman.edu/~hundledr/courses/M244/Poincare.pdf
\documentclass[border=1mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.markings,arrows}
\tikzset
{every pin/.style={pin edge={<-}}
,>=stealth
,flow/.style=
{decoration=
{markings
,mark=at position #1 with {\arrow{>}}
}
,postaction={decorate}
}
,flow/.default=0.5
}
\newcommand\inlayscale{}
\newcommand\inlaycaption[1]{{\sffamily\scriptsize#1}}
\newcommand\newinlay[4][0.18]%
{\renewcommand\inlayscale{#1}%
\newsavebox#2%
\savebox#2%
{\begin{tabular}{@{}c@{}}
#4\\[-1ex]
\inlaycaption{#3}\\[-1ex]
\end{tabular}%
}%
}
\newcommand\inlay[1]{\usebox{#1}}
\newcommand\Tr{\mathop{\mathrm{Tr}}}
\newinlay\saddle{saddle}%
{\begin{tikzpicture}[scale=\inlayscale]
\foreach \sx in {+,-}
{\draw[flow] (\sx4,0) -- (0,0);
\draw[flow] (0,0) -- (0,\sx4);
\foreach \sy in {+,-}
\foreach \a/\b/\c/\d in {2.8/0.3/0.7/0.6,3.9/0.4/1.3/1.1}
\draw[flow] (\sx\a,\sy\b)
.. controls (\sx\c,\sy\d) and (\sx\d,\sy\c)
.. (\sx\b,\sy\a);
}
\end{tikzpicture}%
}
\newinlay\sink{sink}%
{\begin{tikzpicture}[scale=\inlayscale]
\foreach \sx in {+,-}
{\draw[flow] (\sx4,0) -- (0,0);
\draw[flow] (0,\sx4) -- (0,0);
\foreach \sy in {+,-}
\foreach \a/\b in {2/1,3/0.44}
\draw[flow,domain=\sx\a:0] plot (\x, {\sy\b*\x*\x});
}
\end{tikzpicture}%
}
\newinlay\source{source}%
{\begin{tikzpicture}[scale=\inlayscale]
\foreach \sx in {+,-}
{\draw[flow] (0,0) -- (\sx4,0);
\draw[flow] (0,0) -- (0,\sx4);
\foreach \sy in {+,-}
\foreach \a/\b in {2/1,3/0.44}
\draw[flow,domain=0:\sx\a] plot (\x, {\sy\b*\x*\x});
}
\end{tikzpicture}%
}
\newinlay\stablefp{line of stable fixed points}%
{\begin{tikzpicture}[scale=\inlayscale]
\draw (-4,0) -- (4,0);
\foreach \s in {+,-}
{\draw[flow] (0,\s4) -- (0,0);
\foreach \x in {-3,-2,-1,1,2,3}
\draw[flow] (\x,\s3) -- (\x,0);
}
\end{tikzpicture}%
}
\newinlay\unstablefp{line of unstable fixed points}%
{\begin{tikzpicture}[scale=\inlayscale]
\draw (-4,0) -- (4,0);
\foreach \s in {+,-}
{\draw[flow] (0,0) -- (0,\s4);
\foreach \x in {-3,-2,-1,1,2,3}
\draw[flow] (\x,0) -- (\x,\s3);
}
\end{tikzpicture}%
}
\newinlay\spiralsink{spiral sink}%
{\begin{tikzpicture}[scale=\inlayscale]
\draw (-4,0) -- (4,0);
\draw (0,-4) -- (0,4);
\draw[samples=100,smooth,domain=27:7] plot ({\x r}: {0.005*\x*\x});
\draw[->] ({26 r}: {0.005*26*26}) -- +(0.01,-0.01);
\end{tikzpicture}%
}
\newinlay\spiralsource{spiral source}%
{\begin{tikzpicture}[scale=\inlayscale]
\draw (-4,0) -- (4,0);
\draw (0,-4) -- (0,4);
\draw [samples=100,smooth,domain=10:28] plot ({-\x r}: {0.005*\x*\x});
\draw[<-] ({-27.5 r}: {0.005*27.5*27.5}) -- +(0.01,-0.008);
\end{tikzpicture}%
}
\newinlay[0.15]\centre{center}%
{\begin{tikzpicture}[scale=\inlayscale]
\draw (-4,0) -- (4,0);
\draw (0,-4) -- (0,4);
\foreach \r in {1,2,3} \draw[flow=0.63] (\r,0) arc (0:-360:\r cm);
\end{tikzpicture}%
}
\newinlay\degensink{degenerate sink}%
{\begin{tikzpicture}[scale=\inlayscale]
\draw (0,-4) -- (0,4);
\draw[flow] (-4,0) -- (0,0);
\draw[flow] (4,0) -- (0,0);
\draw[flow] (-3.5,3.5) .. controls (4,1.5) and (4,1).. (0,0);
\draw[flow] (3.5,-3.5) .. controls (-4,-1.5) and (-4,-1) .. (0,0);
\draw[flow] (-3.5,2.5) .. controls (2,1) and (2,0.8).. (0,0);
\draw[flow] (3.5,-2.5) .. controls (-2,-1) and (-2,-0.8) .. (0,0);
\end{tikzpicture}%
}
\newinlay\degensource{degenerate source}%
{\begin{tikzpicture}[scale=\inlayscale]
\draw (0,-4) -- (0,4);
\draw[flow] (0,0) -- (-4,0);
\draw[flow] (0,0) -- (4,0);
\draw[flow] (0,0) .. controls (4,1.5) and (4,1).. (-3.5,3.5);
\draw[flow] (0,0) .. controls (-4,-1.5) and (-4,-1) .. (3.5,-3.5);
\draw[flow] (0,0) .. controls (2,1) and (2,0.8).. (-3.5,2.5);
\draw[flow] (0,0) .. controls (-2,-1) and (-2,-0.8) .. (3.5,-2.5);
\end{tikzpicture}%
}
\begin{document}
\begin{tikzpicture}[line cap=round,line join=round]
% Main diagram
\draw[line width=1pt,->] (0,-0.3) -- (0, 4.7) coordinate (+y);
\draw[line width=1pt,->] (-5,0) -- ( 5,0) coordinate (+x);
\draw[line width=1pt, domain=-4:4] plot (\x, {0.25*\x*\x});
\node at (+y) [label={[above,yshift=0.8cm]%
{\sffamily\large Poincar\'e Diagram: Classification of Phase Portaits
in the $(\det A,\Tr A)$-plane}}] {};
\node at (+x) [label={[right,yshift=-0.5ex]$\scriptstyle\Tr A$}] {};
\node at (+y) [label={[above]$\scriptstyle\det A$}] {};
\node at (-4,4) [pin={[above]$\scriptstyle\Delta=0$}] {};
\node at ( 4,4) [pin={[above,align=left]{%
$\scriptstyle\Delta=0$:\\
$\scriptstyle\det A=\frac{1}{4}(\Tr A)^2$}}] {};
% inlays
\node at (0,-1.4) {\inlay\saddle};
\node at (0,1.2)
[pin={[draw,right,xshift=0.3cm]\inlay\centre}] {};
\node at (0,0)
[pin={[draw,above left,align=center,xshift=-0.3cm]%
\inlaycaption{uniform}\\[-1ex]\inlaycaption{motion}}] {};
\node at (-4,1) {\inlay\sink};
\node at ( 4,1) {\inlay\source};
\node at (-3,0) [pin={[draw,below,yshift=-1cm]\inlay\stablefp}] {};
\node at (3,0) [pin={[draw,below,yshift=-1cm]\inlay\unstablefp}] {};
\node at (-1.8,3.7) {\inlay\spiralsink};
\node at ( 1.8,3.7) {\inlay\spiralsource};
\node at (-3.5,{0.25*3.5*3.5})
[pin={[draw,left,xshift=-1.15cm,yshift=-0.3cm]\inlay\degensink}] {};
\node at ( 3.5,{0.25*3.5*3.5})
[pin={[draw,right,xshift=0.9cm,yshift=-0.3cm]\inlay\degensource}] {};
\end{tikzpicture}
\end{document}
我尝试编辑代码来创建另外两个不同的相图,但我无法完全理解代码。
我试图创作这样的相图,
我想了解代码以及如何创建这些示例。
答案1
使用极坐标和序言中定义的样式可以轻松绘制所需的相位轨迹\tikzset
:
\documentclass[tikz, margin=3.14159mm]{standalone}
\usetikzlibrary{decorations.markings}
\tikzset{
> = stealth,
every pin/.style = {pin edge = {<-}},
flow/.style = {decoration = {markings, mark=at position #1 with {\arrow{>}}},
postaction = {decorate}
},
flow/.default = 0.5,
main/.style = {color=#1, line width=1pt, line cap=round, line join=round},
main/.default = black
}
\begin{document}
\begin{tikzpicture}
% axis
\draw [->] (0,-3) -- (0,3) node [above] {$y$};
\draw [->] (-3,0) -- (3,0) node [right] {$x$};
% phase trajectories
\foreach \i in {0, 22.5,...,360}
\draw[main=blue, flow] (0,0) -- (\i:2.5);
\end{tikzpicture}
\begin{tikzpicture}
% axis
\draw [->] (0,-3) -- (0,3) node [above] {$y$};
\draw [->] (-3,0) -- (3,0) node [right] {$x$};
% phase trajectories
\foreach \i in {0, 22.5,...,360}
\draw[main=blue, flow] (\i:2.5) -- (0,0);
\end{tikzpicture}
\end{document}
在您的庞加莱图复杂图像中,您可以像插入其他图像一样插入这些图像:通过存储开发的图像代码(来自上面的 MWE)并以savebox
您选择的名称命名:
\newinlay\XXX{XXX}% XXX name of savebox
{
\begin{tikzpicture}[scale=\inlayscale]
% axis
\draw [->] (0,-3) -- (0,3) node [above] {$y$};
\draw [->] (-3,0) -- (3,0) node [right] {$x$};
% phase trajectories
\foreach \i in {0, 22.5,...,360}
\draw[main=blue, flow] (\i:2.5) -- (0,0);
\end{tikzpicture}
}
并将其作为节点的内容插入到主图像中,放置在所需的坐标上:
\node at (<x-coordinate>,<y-coordinate>) {\inlay\XXX}; % XXX is name of your image save box
从上面您可以看到最终图像设计的工作流程:
- 首先,开发子图像的代码。
- 当代码给出满意的结果时,您将图片代码以选定的名称存储在保存框中(如上所示)。
- 使用该保存框作为主图中节点的内容。
这有帮助吗?对于 MWE 中的序言,使用来自 ( 的序言我的答案)回答您之前的问题。