I am using matplotlib version 1.3.1 with numpy 1.7.1 on a win32 platform for the following code:
import matplotlib
import matplotlib.pyplot as plt
from matplotlib.collections import PatchCollection
import matplotlib.colors as col
import matplotlib.cm as cm
from matplotlib.patches import Wedge
import numpy as np
def register_cmap(cmapName):
"""
Purpose: define colormap using the from_List() method as a
segmented list and register it.
"""
startcolor = '#00AF33' # truegreen
midcolor = '#FFE600' # yolk (a medium dark yellow)
endcolor = '#FF0033' # bright red
cmap2 = col.LinearSegmentedColormap.from_list(cmapName,
[startcolor,midcolor,endcolor])
cm.register_cmap(cmap=cmap2)
return cmap2
# Define my colormap red->yellow->green for curvature
my_cmap = register_cmap('reylgr')
# Modified matplotlib gallery example
radii = np.arange(0.0,1.05,.05) # inner radius of rings
width = 0.05 # width of rings
patches = []
for r in radii:
wedge = Wedge((0.0,0.0), r+width, 0.0,360.0, width = width)
patches.append(wedge)
fig = plt.figure()
ax = fig.add_subplot(111)
colors = radii
p = PatchCollection(patches, cmap=my_cmap)
p.set_array(colors)
ax.add_collection(p)
ax.set_xlim(-1.5,+1.5)
ax.set_ylim(-1.5,+1.5)
plt.colorbar(p)
plt.show()
When I execute this code I do get concentric circles (wedge rings) as expected. However,
I do not want "edges" along the boundaries of the rings. I would like the color changes
between rings to look like the colorbar.
I have tried several options with Wedge (e.g. edgecolor = "none"); but, this had no observable effect.
Help on this would be appreciated.