fig-tensor-sample.tex 1.77 KB
Newer Older
孟霞 committed
1 2 3 4 5 6 7 8 9
%%%------------------------------------------------------------------------------------------------------------
\newcounter{mycount1}
\newcounter{mycount2}
\newcounter{mycount3}
\newcounter{mycount4}

\begin{tikzpicture}
\begin{scope}[yshift=6.5em,xshift=1em]
\setcounter{mycount1}{1}
xiaotong committed
10
\draw[step=0.5cm,color=orange,line width=0.4mm] (-2,-2) grid (1,1);
孟霞 committed
11 12 13 14 15 16 17 18 19
\foreach \y in {+0.5,-0.5,-1.5}
  \foreach \x in {-1.5,-0.5,0.5}{
    \node [fill=orange!20,inner sep=0pt,minimum height=0.98cm,minimum width=0.98cm] at (\x,\y) {\number\value{mycount1}};
    \addtocounter{mycount1}{1};
  }
\end{scope}

\begin{scope}[yshift=5.5em,xshift=0em]
\setcounter{mycount2}{2}
xiaotong committed
20
\draw[step=0.5cm,color=blue,line width=0.4mm] (-2,-2) grid (1,1);
孟霞 committed
21 22 23 24 25 26 27 28 29
\foreach \y in {+0.5,-0.5,-1.5}
  \foreach \x in {-1.5,-0.5,0.5}{
    \node [fill=blue!20,inner sep=0pt,minimum height=0.98cm,minimum width=0.98cm] at (\x,\y) {\number\value{mycount2}};
    \addtocounter{mycount2}{1};
  }
\end{scope}

\begin{scope}[yshift=4.5em,xshift=-1em]
\setcounter{mycount3}{3}
xiaotong committed
30
\draw[step=0.5cm,color=ugreen,line width=0.4mm] (-2,-2) grid (1,1);
孟霞 committed
31 32 33 34 35 36 37 38 39
\foreach \y in {+0.5,-0.5,-1.5}
  \foreach \x in {-1.5,-0.5,0.5}{
    \node [fill=green!20,inner sep=0pt,minimum height=0.98cm,minimum width=0.98cm] at (\x,\y) {\number\value{mycount3}};
    \addtocounter{mycount3}{1};
  }
\end{scope}

\begin{scope}[yshift=3.5em,xshift=-2em]
\setcounter{mycount4}{4}
xiaotong committed
40
\draw[step=0.5cm,color=red,line width=0.4mm] (-2,-2) grid (1,1);
孟霞 committed
41 42 43 44 45 46 47
\foreach \y in {+0.5,-0.5,-1.5}
  \foreach \x in {-1.5,-0.5,0.5}{
    \node [fill=red!20,inner sep=0pt,minimum height=0.98cm,minimum width=0.98cm] at (\x,\y) {\number\value{mycount4}};
    \addtocounter{mycount4}{1};
  }
\end{scope}
\end{tikzpicture}
xiaotong committed
48
%%%------------------------------------------------------------------------------------------------------------