tikz 随笔

前言

用来存放平时画的一些图,水平很低

正文

直线插补的走步轨迹图

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.markings}
\begin{document}
\newcounter{jishu}
\setcounter{jishu}{1}
\def\xx{-- node[below] {\footnotesize\thejishu\stepcounter{jishu}} ++ (-1,0)}
\def\yy{-- node[right] {\footnotesize\thejishu\stepcounter{jishu}} ++ (0,1)}
\begin{tikzpicture}[decoration={markings,mark=between positions 0 and 1 step 10mm with {\fill (0,0) circle (0.05);}}]
\draw[-latex] (0,0) -- ++ (0,4) node[right] {$y$};
\draw[-latex] (-6,0) -- ++ (7,0) node[above] {$x$};
\draw (0,0) -- ++ (-5,3);
\draw[-latex,postaction={decorate}] (0,0) \xx\yy\xx\yy\xx\xx\yy\xx;
\foreach \x in {0,...,-5} {\draw (\x,0) -- ++ (0,0.2);\node[below] at (\x,0) {$\x$};}
\foreach \y in {1,...,3} {\draw (0,\y) -- ++ (0.2,0);\node[left] at (0,\y) {$\y$};}
\end{tikzpicture}
\end{document}

效果

因子图

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning}
\tikzset{
state/.style = {circle, draw, minimum size=0.5cm, anchor=center},
factor/.style = {rectangle, draw, minimum size=0.5cm, anchor=center},
}
\begin{document}
\begin{tikzpicture}
\node[state] (x1) {$x_1$};
\node[factor, below left =of x1] (f1) {$f_1$};
\node[factor, below right =of x1] (f2) {$f_2$};
\node[state, below left =of f1] (x2) {$x_2$};
\node[state, below =of f1] (x3) {$x_3$};
\node[state, below left =of f2] (x4) {$x_4$};
\node[state, below right =of f2] (x6) {$x_6$};
\node[factor, below =of x4] (f3) {$f_3$};
\node[factor, below right =of x4] (f4) {$f_4$};
\node[state, below =of f4] (x5) {$x_5$};

\foreach \i/\j in {x1/f1, f1/x2, f1/x3, x1/f2, f2/x4, f2/x6, x4/f3, x4/f4, f4/x5}
\draw (\i) -- (\j);
\end{tikzpicture}
\end{document}
文章作者: sikouhjw
文章链接: https://sikouhjw.github.io/2020/06/02/2020-06-02-tikz-essays/
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 sikouhjw.github.io
支付宝捐赠
微信捐赠