So I would like to present data using a color plot subdivided into squares. For a large data set, it is easy to use a 3D plot with surf, however when there is not so much information, this does not work so nicely.
Take for example:
\begin{tikzpicture}
\begin{axis}[view={0}{90}]
\addplot3 [surf]
coordinates {
(0, 0, 1) (1, 0, 9) (2, 0, 3)
(0, 1, 4) (1, 1, 5) (2, 1, 6)
(0, 2, 7) (1, 2, 2) (2, 2, 9)};
\end{axis}
\end{tikzpicture}

I have 9 data points, and 4 squares are displayed which reduces greatly the amount of data displayed.
An alternative I thought of was to use square marks
\begin{tikzpicture}
\begin{axis}[view={0}{90}, enlargelimits=.3]
\addplot3 [scatter, mark=square*, mark size=24pt]
coordinates {
(0, 0, 1) (1, 0, 9) (2, 0, 3)
(0, 1, 4) (1, 1, 5) (2, 1, 6)
(0, 2, 7) (1, 2, 2) (2, 2, 9)};
\end{axis}
\end{tikzpicture}

but the result is less than pleasing, and would require a lot of mucking around with the size of the marks.
The only "alternative" is to use interpolation so that at the vertices the correct color is displayed
\begin{tikzpicture}
\begin{axis}[view={0}{90}]
\addplot3 [surf, shader=interp]
coordinates {
(0, 0, 1) (1, 0, 9) (2, 0, 3)
(0, 1, 4) (1, 1, 5) (2, 1, 6)
(0, 2, 7) (1, 2, 2) (2, 2, 9)};
\end{axis}
\end{tikzpicture}
\begin{tikzpicture}
\begin{axis}[view={0}{90}]
\addplot3 [surf, shader=interp, patch type=bilinear]
coordinates {
(0, 0, 1) (1, 0, 9) (2, 0, 3)
(0, 1, 4) (1, 1, 5) (2, 1, 6)
(0, 2, 7) (1, 2, 2) (2, 2, 9)};
\end{axis}
\end{tikzpicture}

But without the correct interpolation, looks ugly. Besides, it doesn't exactly fix the problem of displaying only 9 data points.
So for small data sets, is there a way of plotting exactly the same number of squares as required?
flat corneris a solution, though not exactly ideal as it gives the impression that the data points are actually between the vertices. It is still significantly better though.I gave it more thought, and is it possible to define your own marker so that the width is exactly half of the distance separating vertices, and have the vertical/horizontal scalings independent? That would fix the issue.
Also, should I post this suggestion in the duplicate?
– JP-Ellis Aug 12 '13 at 18:52mark size=1(without unit), provided that\pgfplotsset{compat=<version>}is high enough (1.8will do). In that case, pgfplots will take one axis unit. I believe there was some solution (probably of @Jake) which relied on this feature. And: yes, I suppose flagging this as dupe is a good idea - you can post work-arounds or answers on the original one. – Christian Feuersänger Aug 12 '13 at 19:01mark size=1does not seem to work. I am using\pgfplotsset{compat=1.8}, so I don't know what is the issue. Also, the documentation does not seem to showmark size=1as scaling to one unit.Also, this would not allow x and y scaling to be specified individually? Unless perhaps the cube marker is used?
– JP-Ellis Aug 12 '13 at 19:29mark size=1hint was wrong; I must have mistaken it forbar width(which accepts axis units). Please excuse me. And yes, I meant the link posted by Jake, perhaps it helps you. – Christian Feuersänger Aug 13 '13 at 18:28The only little issue I've been having now is that
– JP-Ellis Aug 15 '13 at 10:18mark=square*has to be square (obviously).mark=cube*however seems to allow custom x/y sizes and I tried adapting Jake's code so that the width and height of the graph aren't affected, but without success. For some reason settings `cube/size x' does not do anything. I also cannot comment on Jake's answer to suggest this possibility (it requires 50 reputations...)