答案1
以下是蛇形图的代码pstricks
:
\documentclass[border=3pt, svgnames]{standalone}
\usepackage{pstricks-add, pst-arrow}
\usepackage{auto-pst-pdf} % to compile with pdflatex
\begin{document}
\psset{xunit=1.5cm, yAxis = false, arrowinset=0.12, ticks=none, labels=none}
\footnotesize
\begin{pspicture}
\psaxes{->}(-1,0)(6.5,0)[$s$, 120][,0]
\dotnodes[dotstyle=|, dotsize=6pt](0,0){O}(0.3,0){a}(2.8,0){d}(4.15,0){c}(5.5,0){b}
\pnode(6.2,2.6){E}
\foreach \N/\L in {O/0,a/3,b/55,c/41.5,d/28}{\uput{2ex}[d](\N){\L}}
\psset{dotstyle=*, dotsize=3pt, unit=5mm}
\foreach \N/\P[count=\i] in {a/A,b/B,c/C,d/D}{\nput*[labelsep=\i]{90}{\N}{\dotnode{\P}}}%
\nput*[labelsep=2.8]{0}{A}{\pnode{A1}}
\nput*[labelsep=1.8]{180}{C}{\pnode{C1}}
\uput[l](A){$t = 0$}\uput[r](B){$t =2$}\uput[u](C){$t =\frac{7}{2}$}\uput[l](D){$t = 5$}%
\psset{linewidth=1.2pt, linecolor=DeepSkyBlue, linearc=0.8, angleB=-90, armB=0, }
\ncangle{A}{B}\ncline[arrows=->]{A}{A1}
\ncangle[angleA=180]{C}{D}\ncline[arrows=->]{C}{C1}
\psset{angleA=90, armA=0,angleB=0, linecolor=DeepPink}
\ncangle{B}{C}
\ncangle[arrows=->, angleB=180]{D}{E}
\end{pspicture}
\end{document}
编辑:第二张图的代码
\documentclass[border=3pt, svgnames]{standalone}
\usepackage{pstricks-add}
\usepackage{auto-pst-pdf} % to compile with pdflatex
\begin{document}
\psset{ yAxis = false, arrowinset=0.12, ticks=none, labels=none}
\footnotesize
\begin{pspicture}
\psaxes{->}(-1,0)(7,0)[$t$, 120][,0]
\dotnodes[dotstyle=|, dotsize=4pt, linewidth=0.4pt](0,3pt){O}(2,3pt){a}(3.5,3pt){b}(5,3pt){c}
\foreach \N/\L in {O/0,a/2,b/\frac{7}{2},c/5}{\uput[u](\N){$\L$}}
\uput[d](a){$0$}\uput[d](c){$0$}
\ncline[nodesep=2pt, offset=-8pt, linecolor=DeepPink, linewidth=0.7pt, linestyle=dashed, dash=3.5pt 2.5pt]{a}{c}
\psset{linecolor=DeepSkyBlue, linestyle=none, showpoints, plotpoints=8, dotstyle=+}
\psplot{0}{1.8}{-0.18}
\psplot{5.2}{6.8}{-0.18}
\end{pspicture}
\end{document}
答案2
以下是使用 绘制图形的可能方法tikz
。
第一张图:
\documentclass[border=1cm]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning, arrows.meta}
\usetikzlibrary{decorations.markings}
\tikzset{
mynode/.style={draw, circle, fill=black,
inner sep=0pt,
minimum width=4pt},
myline/.style={very thick, rounded corners=9},
mydecor/.style={postaction={decorate, decoration={markings,mark=at position #1 with {\arrow{Stealth};}}}},
}
\begin{document}
\begin{tikzpicture}
\draw[-Stealth] (-7mm,0) -- (70mm, 0);
\foreach \pos/\id in {0/A, 3/B, 28/C, 41.5/D, 55/E}{
\draw (\pos mm,0) -- (\pos mm, 2mm);
\node at (\pos mm,-3mm) (\id) {\pos};
}
\node[mynode, label=left:{$t=5$}, above=14pt of B] (start) {};
\node[mynode, label=right:{$t=2$}, above=26pt of E] (second) {};
\node[mynode, label=above:{$t=\frac{7}{2}$}, above=38pt of D] (third) {};
\node[mynode, label=left:{$t=5$}, above=50pt of C] (fourth) {};
\draw[
myline, cyan,
mydecor={0.25},
] (start) -| (second);
\draw[myline, red] (second) |- (third);
\draw[myline, cyan,
mydecor={0.5},
] (third) -| (fourth);
\draw[myline, -Stealth, red] (fourth) -- ++ (0,12pt) -- ++ (42mm,0);
\end{tikzpicture}
\end{document}
第二张图:
\documentclass[border=1cm]{standalone}
\usepackage{bm}
\usepackage{tikz}
\usetikzlibrary{positioning, arrows.meta}
\usetikzlibrary{decorations.markings}
\tikzset{
plusdecor/.style={
cyan,
postaction={
decorate, decoration={
markings,
mark=between positions 0 and 1 step .73em with{\node[font=\tiny] {$\bm{+}$};}
}
}
},
minusdecor/.style={
red,
postaction={
decorate, decoration={
markings,
mark=between positions 0 and 1 step .73em with{\node[font=\tiny] {$\bm{-}$};}
}
}
},
}
\begin{document}
\begin{tikzpicture}
\draw[-Stealth,very thick] (-7mm,0) -- (70mm, 0);
\foreach \pos/\id/\descr in {0/AA/0, 20/BB/2, 35/CC/{\raisebox{8.6pt}{$\frac{7}{2}$}}, 50/DD/5
}{
\draw (\pos mm,0) -- (\pos mm, 2mm);
\node at (\pos mm,5mm) (\id) {\descr};
}
\node at (68mm,3mm) {$t$};
\node[below=8pt of BB] (belowBB) {$0$};
\node[below=8pt of DD] (belowDD) {$0$};
\path[plusdecor] (belowBB) -- +(-22mm, 0);
\path[minusdecor] (belowBB) -- (belowDD);
\path[plusdecor] (belowDD) -- +(18mm,0);
\end{tikzpicture}
\end{document}