Today I have a question about scatter plots:
Is it possible to interpolate scatter plots?
In my work I often use "intensity plots" (that's how we call them). In these plots x and y are positions, while the color of a point is determined by the intensity. This kind of plot can be created using a 3D-surface plot and setting view={0}{90}. The result can be seen in the right plot. The left plot shows the corresponding scatter plot.
Since 3D plots take a long time to create (to cite the pgfplots manual:"pgfplots’ three dimensional routines are slow"), especially for larger datasets, and since I actually don't want a 3D plot, I would like to know wheter there is a way to make the scatter plot on the left look like the 3D plot on the right.
Here is the code for my example:
\documentclass[crop,10pt]{standalone}
\usepackage[english]{babel}
\usepackage{pgfplots}
\usepgfplotslibrary{units}
\begin{document}%
\setlength{\textwidth}{246pt}%
\setlength{\linewidth}{246pt}%
\begin{tikzpicture}
\begin{axis}
\addplot+[scatter,scatter src=explicit,mark=square*,only marks]
coordinates {
(0,0) [0]
(0,1) [1]
(0,2) [2]
(0,3) [3]
(1,0) [4]
(1,1) [5]
(1,2) [6]
(1,3) [7]
(2,0) [8]
(2,1) [9]
(2,2) [10]
(2,3) [11]
};
\end{axis}
\end{tikzpicture}
\begin{tikzpicture}
\begin{axis}[view={0}{90}]
\addplot3[surf,shader=interp]
coordinates {
(0,0,0) (1,0,4) (2,0,8)
(0,1,1) (1,1,5) (2,1,9)
(0,2,2) (1,2,6) (2,2,10)
(0,3,3) (1,3,7) (2,3,11)
};
\end{axis}
\end{tikzpicture}
\end{document}

Thanks for your help,
John
scatter src=f(x)for the scatter plot) – Christian Feuersänger Nov 9 '12 at 13:21addplot3– Janek Nov 9 '12 at 14:01shader=interpapproach is the most compact form and is relatively fast. The problem which causes long processing times is the number of data points (which is probably much larger for a scatter plot, by the way). There is just one way to reduce time: to generate the surface plot somehow, save it as image, and import it using\addplot graphicsor\addplot3 graphics. Or to compile the image's pdf just ones and include it often (externallib) – Christian Feuersänger Nov 9 '12 at 15:34\addplot graphicsone always has to set the axes minima and maxima manually, which is time consuming if they are different from plot to plot. And compiling the plots just once in an extra pdf will result in different axis and tick label sizes when I change the size of the image in the final pdf. – Janek Nov 9 '12 at 15:49