Hello,
I'm trying to use fill_between in the following script:
[code]
#!/usr/bin/env python
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
import pdb
from jfb import readcsv
#D = np.loadtxt('lat_sectors.csv',skiprows=1,delimiter=',')
head,D = readcsv('lat_sectors.csv',head=1)
D = np.array(D)
data = D[:,1:]
fig = plt.figure()
ax = fig.add_subplot(211)
plt.grid(True)
data = np.cumsum(data,axis=1)
m,n = D.shape
norm = mpl.colors.normalize(0,n)
for i in range(1,n-1):
cmap = mpl.cm.gist_ncar(norm(i))
if i == 1:
ax.fill_between(D[:,0],np.zeros(m),D[:,i],label='some.{0}'.format(i))
else:
ax.fill_between(D[:,0],D[:,i-1],D[:,i],label=head[i],facecolor=cmap,edgecolor='none')
#ax.fill(D[:,0],D[:,i],label='{0}'.format(i),facecolor=cmap)
#ax.legend((ax.collections),([str(i) for i in range(len(ax.collections))]))
plt.xlabel('Latitude, N')
plt.ylabel('BC Emissions, Gg yr-1')
plt.xlim([-50,80])
#plt.ylim([0,1])
plt.legend()
plt.show()
[/code]
But when I run it I get the following error:
/usr/lib/pymodules/python2.6/matplotlib/axes.py:4014: UserWarning: No
labeled objects found. Use label='...' kwarg on individual plots.
warnings.warn("No labeled objects found. "
But, clearly, you can see I am using the label keyword. Is this a bug,
or am I missing something?
Thank you,
john