# Example: Scatter plot with cubes

Published 2014-03-15 | Author: Christian FeuersÃ¤nger

This scatter plot example uses mark=cube* and z buffer=sort to place boxes at each input coordinate. The color for each box is determined by point meta={x+y+3}. The remaining keys are just for pretty printing.

The code is from the PGFPlots 1.10 manual: “4.6.4 Scatter Plots”, “Stacked Bar Plots and Nodes Near Coords”.

Do you have a question regarding this example, TikZ or LaTeX in general? Just ask in the LaTeX Forum.
Oder frag auf Deutsch auf TeXwelt.de.

\documentclass[border=10pt]{standalone}
\usepackage{pgfplots}
\pgfplotsset{width=7cm,compat=1.8}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
view={120}{40},
width=220pt,
height=220pt,
grid=major,
z buffer=sort,
xmin=-1,xmax=9,
ymin=-1,ymax=9,
zmin=-1,zmax=9,
enlargelimits=upper,
xtick={-1,1,...,19},
ytick={-1,1,...,19},
ztick={-1,1,...,19},
xlabel={$l_1$},
ylabel={$l_2$},
zlabel={$l_3$},
point meta={x+y+z+3},
colormap={summap}{
color=(black); color=(blue);
color=(black); color=(white)
color=(orange) color=(violet)
color=(red)
},
scatter/use mapped color={
draw=mapped color,fill=mapped color!70},
]
% pgfplots_scatter4.dat' contains a large sequence of
% the form
% l_0   l_1     l_2
% 1     6       -1
% -1    -1      -1
table {pgfplots_scatterdata4.dat};
\end{axis}
\end{tikzpicture}
\end{document}
`