|
From: Tim B. <tim...@ma...> - 2011-01-18 03:29:17
|
I'm generating images that I want to use as overlays in Google Earth. Thus, I would like the masked portion of the numpy arrays I am using to appear as transparent. However, I seem to consistently get white instead of a transparent point. To clarify the issue, I wrote this short piece of code. I am setting both the figure background to transaprent and the masked value to transparent but I get white. I have pulled the current svn code and built matplotlib. I get the same issue. from numpy import ma import matplotlib.pyplot as plt from pylab import colorbar, imshow, show, cm def main(): a = ma.array([[1,2,3],[4,5,6]],mask=[[0,0,1],[0,0,0]]) fig = plt.figure() fig.patch.set_alpha(0.0) cmap = cm.jet cmap.set_bad(alpha=0.0) imshow(a, interpolation='nearest', cmap=cmap) colorbar() show() Any thoughts? Tim B |