I think you're going about this a bit backwards. There's no completely generic way to determine what white would be in a colormap (it may exist more than once or not at all).
However, you can just specify that the edges of the polygons should be white when using a PolyCollection while still using the colormap for the faces. Just specify edgecolors
instead of edgecolor
. It's a touch confusing, but the idea is that it's plural, as you could have multiple values specified. Also, have a look at RegularPolygonCollection
As a quick example:
import matplotlib.pyplot as plt
from matplotlib.patches import RegularPolygon
from matplotlib.collections import PatchCollection
import numpy as np
xy = np.random.random((10,2))
z = np.random.random(10)
patches = [RegularPolygon((x,y), 5, 0.1) for x, y in xy]
collection = PatchCollection(patches, array=z, edgecolors='white', lw=2)
fig, ax = plt.subplots()
# So that the white edges show up...
ax.patch.set(facecolor='black')
ax.add_collection(collection)
ax.autoscale()
plt.show()