I think I found a bug with in the Axes3D color support. When there are 3 or 4 points to plot, then the you cannot specify an array of rgba arrays for the colors of the points.
I tested in matplotlib 0.99.1 and the latest code from SVN. Both exibit the bug. This simple code demonstrates the bug:
#simple Axes3D example setting color and size of points
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
from numpy.random import rand
fig = plt.figure()
ax = Axes3D(fig)
n = 3 # ERROR WHEN n = 3 or 4 !!
xs = np.random.rand(n)
ys = np.random.rand(n)
zs = np.random.rand(n)
ss = np.random.rand(n) * 1000
cs = rand(n, 4)
ax.scatter(xs, ys, zs, s=ss, c=cs)
ax.set_xlabel('X Label')
ax.set_ylabel('Y Label')
ax.set_zlabel('Z Label')
plt.show()
#end code
This is the call trace for the bug:
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Python26\lib\lib-tk\Tkinter.py", line 1410, in __call__
return self.func(*args)
File "C:\Python26\lib\site-packages\matplotlib\backends\backend_tkagg.py", line 212, in resize
self.show()
File "C:\Python26\lib\site-packages\matplotlib\backends\backend_tkagg.py", line 215, in draw
FigureCanvasAgg.draw(self)
File "C:\Python26\lib\site-packages\matplotlib\backends\backend_agg.py", line314, in draw
self.figure.draw(self.renderer)
File "C:\Python26\lib\site-packages\matplotlib\artist.py", line 46, in draw_wrapper
draw(artist, renderer, *kl)
File "C:\Python26\lib\site-packages\matplotlib\figure.py", line 773, in draw
for a in self.axes: a.draw(renderer)
File "C:\Python26\lib\site-packages\mpl_toolkits\mplot3d\axes3d.py", line 150, in draw
for col in self.collections]
File "C:\Python26\lib\site-packages\mpl_toolkits\mplot3d\art3d.py", line 290, in do_3d_projection
self.set_facecolors(zalpha(self._facecolor3d, vzs))
File "C:\Python26\lib\site-packages\mpl_toolkits\mplot3d\art3d.py", line 497, in zalpha
colors = [(c[0], c[1], c[2], c[3] * s) for c, s in zip(colors, sats)]
IndexError: index out of bounds
Thanks,
-Ben