I want to draw a Z-Curve in LaTeX using TikZ
and the Lindenmayer system. But I did not manage to position the curves central over each bullet point. Furthermore I do not find any elegant way such that all curves have the same size.
Here is what I get:
Here is my code:
\documentclass[a4paper,11pt]{article}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{tikz}
\begin{document}
\usetikzlibrary{lindenmayersystems}
\pgfdeclarelindenmayersystem{z-curve}{
\symbol{I}{\pgftransformscale{+0.25\pgflsystemstep}}
\symbol{p}{%
\pgfpathmoveto{\pgfqpoint{1pt}{3pt}}\pgfpathlineto{\pgfqpoint{3pt}{3pt}}%
\pgfpathlineto{\pgfqpoint{1pt}{1pt}}\pgfpathlineto{\pgfqpoint{3pt}{1pt}}%
}
\symbol{q}{%
\pgfpathlineto{\pgfqpoint{1pt}{3pt}}\pgfpathlineto{\pgfqpoint{3pt}{3pt}}%
\pgfpathlineto{\pgfqpoint{1pt}{1pt}}\pgfpathlineto{\pgfqpoint{3pt}{1pt}}%
}
\symbol{S}{\pgftransformscale{+0.5pt}}
\symbol{A}{\pgftransformshift{\pgfqpoint{0pt}{4pt}}}
\symbol{B}{\pgftransformshift{\pgfqpoint{4pt}{4pt}}}
\symbol{C}{\pgftransformshift{\pgfqpoint{4pt}{0pt}}}
\symbol{[}{\bgroup}
\symbol{]}{\egroup}
\rule{Z -> Ip}
\rule{p -> S[Ap][Bq][q][Cq]}
\rule{q -> S[Aq][Bq][q][Cq]}
}
\begin{figure}[ht]
\centering
\subcaptionbox{}
{\begin{tikzpicture}[scale=2]
\draw [l-system={z-curve, step=1cm, axiom=Z, order=1}] l-system;
\end{tikzpicture}}
\hspace{1cm}
\subcaptionbox{}
{\begin{tikzpicture}[scale=2]
\draw [l-system={z-curve, step=1cm, axiom=Z, order=2}] l-system;
\end{tikzpicture}}
\hspace{1cm}
\subcaptionbox{}
{\begin{tikzpicture}[scale=2]
\draw [l-system={z-curve, step=1cm, axiom=Z, order=3}] l-system;
\end{tikzpicture}}
\hspace{1cm}
\subcaptionbox{}
{\begin{tikzpicture}[scale=2]
\draw [l-system={z-curve, step=1cm, axiom=Z, order=4}] l-system;
\end{tikzpicture}}
\end{figure}
\end{document}
Any suggestion what I should change to get what I want?