Recently I have discovered pgfplots and I am impressed by the capabilities of this package. There is however one type of plots which I cannot figure out how to define conveniently using pgfplots.
Basically I would like to plot a square grid with a subset of squares marked (I'm sorry, as a new user I'm not allowed to post images). I am aware that I can follow/modify the example from the manual in which a closed shape is drawn:
% Preamble: \pgfplotsset{width=7cm,compat=1.6}
\begin{tikzpicture}
\begin{axis}
\addplot+[fill] coordinates
{(0,1) (1,2) (0,3) (-1,2)} --cycle;
\end{axis}
\end{tikzpicture}
But I'm wondering – is it possible to define such plot passing only the integer coordinates of squares to mark, rather than lists of four precise corners of each square?
Best Answer
I wasn't sure if you wanted stacks or slabs, so here is both:
Edit 1: I managed it, only forgot the
\expandafter
before\csname
yesterday.Updated
\getslab
Updated
\drawslabs
New sample input
New sample output (with
geometry
optiona3paper
)