Feb 13, 2010

Node plot and position in Tikz

It is difficult to create a neat, accurate and fancy scientific figure. Tikz/pgf, pstricks, metapost are not easy to learn, nor for me to have a full knowledge of their capabilities. On the other hand, gimp or photoshop is not suitable to produce figures from calculated data. I hope there will be a very handy tool that can help me using Tikz, or metapost easily. But I tested several java based front end. None of them would be a choice.

Here is an example of plotting nodes and point them to each other with arrows, with position determination. It is mainly about '\node', '\draw' and their decoration. It is easy to understand how it is produced, hence, I put no comments here.

-----------------------

\begin{tikzpicture}
\draw[dash pattern=on 2pt off 3pt on 4pt off 4pt](2,.2) -- (2,3.2);
\draw[dash pattern=on 2pt off 3pt on 4pt off 4pt](4,.2) -- (4,3.2);
\draw[dash pattern=on 2pt off 3pt on 4pt off 4pt](6,.2) -- (6,3.2);
\node at (2,2.9) [fill=blue!50,draw,circle, drop shadow,
label=left:\tiny{$x_k^b$}] (n1){};
\node at (2,1.9) [fill=red!50,draw,circle, drop shadow,label=left:\tiny{$x_k^a$}] (n2){};
\node at (2,.9) [fill=green!50,draw,circle, drop shadow,label=left:\tiny{$y_k^o$}] (n3){};
\node at (4,1.9) [fill=red!50,draw,circle, drop shadow,label=left:\tiny{$x_{k+1}^a$}] (n4){};
\node at (4,2.9) [fill=blue!50,draw,circle, drop shadow,label=left:\tiny{$x_{k+1}^b$}] (n5){};
\node at (4,.9) [fill=green!50,draw,circle, drop shadow,label=left:\tiny{$y_{k+1}^o$}] (n6){};
\node at (6,1.9) [fill=red!50,draw,circle, drop shadow,label=left:\tiny{$x_{k+2}^a$}] (n7){};
\node at (6,.9) [fill=green!50,draw,circle, drop shadow,label=left:\tiny{$y_{k+2}^o$}] (n8){};
\node at (6,2.9) [fill=blue!50,draw,circle, drop shadow,label=left:\tiny{$x_{k+2}^b$}] (n9){};
\node at (8,2.9) [fill=blue!20, anchor=base](n10){$\cdots$};
\draw[->, line width=1pt] (1,0.2) -- (10,0.2) node[right]{time};
\node at (2,0.2)[below]{\tiny{$k$}};
\node at (4,0.2)[below]{\tiny{$k+1$}};
\node at (6,0.2)[below]{\tiny{$k+2$}};
\end{tikzpicture}
\begin{tikzpicture}[overlay]
\path[->] (n2) edge [bend right] (n5);
\path[->] (n4) edge [bend right] (n9);
\path[->] (n7) edge [bend right] (n10);
\end{tikzpicture}
\vspace{7mm}
\begin{itemize}
\item \tikz\node [fill=blue!50,draw,circle]{}; Background state $x^b$
\item \tikz\node [fill=red!50,draw,circle]{}; Analysis state $x^a$
\item \tikz\node [fill=green!50,draw,circle]{}; Observation $y^o$
\end{itemize}

1 comment:

数声风笛离亭晚,我想潇湘君想秦! said...

I thought maybe the combination of Pstricks and latexdraw is a choice for scientific drawing! After seeing your post It seems that Tiks is also a good choice!