我几乎完成了 pgfplot 的图表,但仍缺少一些细节。我希望你们中的一些人愿意帮助我。
这是几乎完成的图表:
\documentclass{standalone}
\usepackage{pgfplots}
\usetikzlibrary{arrows.meta}
\pgfplotsset{compat=1.13}
\begin{document}
\centering
\begin{tikzpicture}
\begin{axis}[
axis lines=middle,
title style={yshift=6ex},
grid=both,
xlabel=$Time~(T_n)$, ylabel=$States~(X_n)$,
xmin=0,xmax=20,
ymin=0,ymax=4,
axis line style={-Latex[round]},
ticklabel style={font=\footnotesize,fill=white},
extra x ticks={0},
extra x tick labels ={$t_0$},
xtick={1.2, 2.4, 3.6, 4.8, 6, 7.2, 8.4, 9.6, 10.8, 12, 13.2, 14.4, 15.6, 16.8, 18, 19.2},
xticklabels={$t_1$, $t_2$, $t_3$, $t_4$, $t_5$, $t_6$, $t_7$, $t_8$, $t_9$, $t_{10}$, $t_{11}$, $t_{12}$, $t_{13}$, $t_{14}$, $t_{15}$, $t_{16}$},
ytick={0.5, 1, 1.5, 2, 2.5, 3, 3.5},
yticklabels={$CCC$, $B$, $BB$, $BBB$, $A$, $AA$, $AAA$},
extra y ticks={0},
extra y tick labels={$D$},
yticklabel style={anchor=east},
xlabel style={at={(ticklabel* cs:1)},anchor=north west},
ylabel style={at={(ticklabel* cs:1)},anchor=south west},
width=11cm,
]
\end{axis}
\begin{axis}[
at={(0,-0.7cm)},
axis x line*=left, axis y line=none,
xticklabels={$T_0$, $T_1$, $T_2$, \scriptsize{$s$}, $T_3$, $T_4$, $T_5$, $T_6$, \scriptsize{$s$}\tiny{+}\scriptsize{$t$}, $T_7$},
xtick={0, 2.4, 4.8, 6, 8.4, 12, 13.2, 15.6, 16.8, 18},
axis line style={-Latex[round]},
ticklabel style={font=\footnotesize,fill=white},
xmin=0,xmax=20,
ymin=0,ymax=4,
ytick={0.5, 1, 1.5, 2, 2.5, 3, 3.5},
width=11cm,
]
\addplot[->,>={}] coordinates{
(0,2.855)
(2.4,2.855)
(2.4,1.855)
(4.8,1.855)
(4.8,1.355)
(8.4,1.355)
(8.4,0.855)
(12,0.855)
(12,2.355)
(13.2,2.355)
(13.2,2.355)
(15.6,2.355)
(15.6,3.355)
(18,3.355)
(18.1,1.355)
(20,1.355)
};
\draw [fill,black] (0.05,2.855) circle [radius=1.5pt];
\draw [fill,black] (2.4,1.855) circle [radius=1.5pt];
\draw [fill,black] (4.8,1.355) circle [radius=1.5pt];
\draw [fill,black] (8.4,0.855) circle [radius=1.5pt];
\draw [fill,black] (12,2.355) circle [radius=1.5pt];
\draw [fill,black] (13.2,2.355) circle [radius=1.5pt];
\draw [fill,black] (15.6,3.355) circle [radius=1.5pt];
\draw [fill,black] (18,1.355) circle [radius=1.5pt];
\end{axis}
\end{tikzpicture}
\end{document}
在这张图片中我添加了一些我仍然缺少的细节:
对于习惯使用 pgfplots 的人来说,这应该不难。请注意,即使是类似于建议的内容也会有很大帮助。谢谢!
答案1
作为起点,解决方案的一部分如下。
1- 为你的环境添加过度支撑风格tikzpicture
:
\begin{tikzpicture}[
brc/.style args = {#1/#2}{decorate,
decoration={brace, amplitude=5pt,
raise=#1,#2},% for mirroring of brace
thick}]
\begin{axis}[
axis lines=middle,
title style={yshift=6ex},
.
.
.
2-绘图:
\draw [fill,black] (0.05,2.855)coordinate (X0) circle [radius=1.5pt] node[above right=0.2cm]{\tiny $X_0=A$};
\draw [-latex] (X0)--++(20:0.5);
\draw [fill,black] (2.4,1.855)coordinate (X1) circle [radius=1.5pt] node[above right=0.2cm]{\tiny $X_1=BB$};
\draw [-latex] (X1)--++(20:0.5);
\draw [fill,black] (4.8,1.355) circle [radius=1.5pt];
\draw [fill,black] (8.4,0.855) circle [radius=1.5pt];
\draw [fill,black] (12,2.355) circle [radius=1.5pt];
\draw [fill,black] (13.2,2.355) circle [radius=1.5pt];
\draw [fill,black] (15.6,3.355) circle [radius=1.5pt];
\draw [fill,black] (18,1.355) circle [radius=1.5pt];
\draw [dashed] (6,0)--(6,1.5);
\draw [red] (4.8,0.5)--(6,0.5);
\draw [brc=1mm/] (4.8,0.5)--node[above=3mm]{\tiny $=l$}(6,0.5);
%\draw[decorate,decoration={overbrace,amplitude=3pt,mirror}] (4.8,0.5) -- (6,0.5 );
\draw [blue] (6,0.5)--(8.4,0.5);
\draw [brc=1mm/] (6,0.5)--node[above=3mm]{\tiny $=u$}(8.4,0.5);
将产生: