Dear all,
Once again, I turn for help.
I'm trying to plot a polar image using colormap values for the theta values and
increasing alpha values along the radius.
I do this using imshow passing the rgba tuple at each pixel position which
works
very nicely with rectangular axes, but fails to display using polar axes (see
code below).
As usual, I've done a fair bit of digging to find where the problem is and
whether I could make out an alternate solution but haven't managed to come
through. I've tried using pcolormesh but I don't see how to pass the rgba tuple
Can anyone point me in the right direction.
I'm using matplotlib 1.0.1 and Python 2.4
Cheers,
Auré
------
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()
------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users