3

I have created a tikzpicture with a matrix with a timeline element. It is difficult to place the timestamps at either end of the timeline appropriately. Does anyone have a suggestion? Thanks!

Edit: Harish Kumar pointed out the issue that was causing \centering not to work. Thanks Mr. Kumar.

Here is the output:

pdf output from latex tikz

Here is the code (the quads are ugly, but I'm a tikz newbie):

\documentclass[journal]{IEEEtran}
\usepackage{tikz}
\usetikzlibrary{matrix}
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}
\matrix(dict)[matrix of nodes,nodes={align=center,text width=0.17cm},
]{
    5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5\\
    \quad & \\
    5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5\\
    \quad & \\
    5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5\\
    \quad & \\
    5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5\\
    \quad & \\
    \quad & \quad & \quad & \quad & \quad & \quad & \quad & \quad & \quad & \quad & \quad & \quad & \quad & \quad & \quad & \quad & \quad & \quad & \quad & \quad & \quad \\
    \quad & \quad & \quad & \quad & \quad & \quad & \quad & \quad & \quad & \quad & \quad & \quad & \quad & \quad & \quad & \quad & \quad & \quad & \quad & \quad & \quad \\
    {\rotatebox{90}{0:00}} & & & & & & & & & & & & & & & & & & & & {\rotatebox{90}{1:45}} \\
};
\draw(dict-1-1.north west)--(dict-1-21.north east);
\draw(dict-1-1.south west)--(dict-1-21.south east);
\draw(dict-1-1.north west)--(dict-1-1.south west);
\draw(dict-1-4.north west)--(dict-1-4.south west);
\draw(dict-1-7.north west)--(dict-1-7.south west);
\draw(dict-1-10.north west)--(dict-1-10.south west);
\draw(dict-1-13.north west)--(dict-1-13.south west);
\draw(dict-1-16.north west)--(dict-1-16.south west);
\draw(dict-1-19.north west)--(dict-1-19.south west);
\draw(dict-1-21.north east)--(dict-1-21.south east);

\draw(dict-3-1.north west)--(dict-3-21.north east);
\draw(dict-3-1.south west)--(dict-3-21.south east);
\draw(dict-3-1.north west)--(dict-3-1.south west);
\draw(dict-3-7.north west)--(dict-3-7.south west);
\draw(dict-3-13.north west)--(dict-3-13.south west);
\draw(dict-3-19.north west)--(dict-3-19.south west);

\draw(dict-5-1.north west)--(dict-5-21.north east);
\draw(dict-5-1.south west)--(dict-5-21.south east);
\draw(dict-5-1.north west)--(dict-5-1.south west);
\draw(dict-5-10.north west)--(dict-5-10.south west);
\draw(dict-5-19.north west)--(dict-5-19.south west);

\draw(dict-7-1.north west)--(dict-7-21.north east);
\draw(dict-7-1.south west)--(dict-7-21.south east);
\draw(dict-7-1.north west)--(dict-7-1.south west);
\draw(dict-7-13.north west)--(dict-7-13.south west);

\draw(dict-9-1.south west)--(dict-9-21.south east);
\draw(dict-10-1.north west)--(dict-10-1.south west);
\draw(dict-10-21.north east)--(dict-10-21.south east);
\end{tikzpicture}
\caption{Market clearing frequency in five minute resolution}
\label{fig:market-timing}
\end{figure}
\end{document}
0

1 Answer 1

2

I just applied some lapping to your timeline labels

\documentclass[journal]{IEEEtran}
\usepackage{tikz}
\usetikzlibrary{matrix}
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}
\matrix(dict)[matrix of nodes,nodes={align=center,text width=0.17cm},
]{
    5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5\\
    \quad & \\
    5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5\\
    \quad & \\
    5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5\\
    \quad & \\
    5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5 & 5\\
    \quad & \\
    \quad & \quad & \quad & \quad & \quad & \quad & \quad & \quad & \quad & \quad & \quad & \quad & \quad & \quad & \quad & \quad & \quad & \quad & \quad & \quad & \quad \\
    \quad & \quad & \quad & \quad & \quad & \quad & \quad & \quad & \quad & \quad & \quad & \quad & \quad & \quad & \quad & \quad & \quad & \quad & \quad & \quad & \quad \\
    {\llap{\rotatebox{90}{0:00}$\;$}} & & & & & & & & & & & & & & & & & & & & {\rlap{$\;$\rotatebox{90}{1:45}}} \\
};
\draw(dict-1-1.north west)--(dict-1-21.north east);
\draw(dict-1-1.south west)--(dict-1-21.south east);
\draw(dict-1-1.north west)--(dict-1-1.south west);
\draw(dict-1-4.north west)--(dict-1-4.south west);
\draw(dict-1-7.north west)--(dict-1-7.south west);
\draw(dict-1-10.north west)--(dict-1-10.south west);
\draw(dict-1-13.north west)--(dict-1-13.south west);
\draw(dict-1-16.north west)--(dict-1-16.south west);
\draw(dict-1-19.north west)--(dict-1-19.south west);
\draw(dict-1-21.north east)--(dict-1-21.south east);

\draw(dict-3-1.north west)--(dict-3-21.north east);
\draw(dict-3-1.south west)--(dict-3-21.south east);
\draw(dict-3-1.north west)--(dict-3-1.south west);
\draw(dict-3-7.north west)--(dict-3-7.south west);
\draw(dict-3-13.north west)--(dict-3-13.south west);
\draw(dict-3-19.north west)--(dict-3-19.south west);

\draw(dict-5-1.north west)--(dict-5-21.north east);
\draw(dict-5-1.south west)--(dict-5-21.south east);
\draw(dict-5-1.north west)--(dict-5-1.south west);
\draw(dict-5-10.north west)--(dict-5-10.south west);
\draw(dict-5-19.north west)--(dict-5-19.south west);

\draw(dict-7-1.north west)--(dict-7-21.north east);
\draw(dict-7-1.south west)--(dict-7-21.south east);
\draw(dict-7-1.north west)--(dict-7-1.south west);
\draw(dict-7-13.north west)--(dict-7-13.south west);

\draw(dict-9-1.south west)--(dict-9-21.south east);
\draw(dict-10-1.north west)--(dict-10-1.south west);
\draw(dict-10-21.north east)--(dict-10-21.south east);
\end{tikzpicture}
\caption{Market clearing frequency in five minute resolution}
\label{fig:market-timing}
\end{figure}
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .