|
From: Michael D. <md...@st...> - 2011-03-15 17:06:24
|
Can you provide a standalone example? This below is missing some imports and there are some mystery variables. Mike On 03/15/2011 12:25 PM, Auré Gourrier wrote: > import matplotlib as mpl > from matplotlib import pylab > import numpy as np > > #build custom colormap > cm_sym =customfunc() > > #define mesh grid > theta = np.arange(0.,2.*math.pi+2.*math.pi/9,2.*math.pi/9) > r = np.arange(0,1.1,0.1) > X,Y = np.meshgrid(r,theta) > > #define rgba array > polarcolorseq = mpl.cm.ScalarMappable(cmap=cm_hsvsym).to_rgba(Y) > #set an increasing alpha value along the radius > polarcolorseq[:,:,-1] = [list(np.arange(0,1.1,.1))]*10 > > pylab.figure(figsize=(10,5),dpi=100,facecolor='white') > > #display using rectangular axis > ax = pylab.subplot((121),axisbg='k') > ax.imshow(np.flipud(np.swapaxes(polarcolorseq,0,1))) > > #display using polar axis > ax2 = pylab.subplot((122),axisbg='k',projection='polar') #also > tried with polar=True > ax2.imshow(np.flipud(np.swapaxes(polarcolorseq,0,1))) > > pylab.draw() -- Michael Droettboom Science Software Branch Space Telescope Science Institute Baltimore, Maryland, USA |