You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
testing with numpy 1.10rc1 revealed some bugs through their deprecation warnings. One in particular is in the interaction of contour/contourf with colorbar. It seems that add_lines() requires that inputs have the same lengths, but it does not check if this is the case. If I add in a check for this, one of our tests fails:
======================================================================
ERROR: test suite for <class 'matplotlib.tests.test_contour.test_given_colors_levels_and_extends'>
----------------------------------------------------------------------
Traceback (most recent call last):
File "/nas/home/broot/centos6/lib/python2.7/site-packages/nose-1.1.2-py2.7.egg/nose/suite.py", line 208, in run
self.setUp()
File "/nas/home/broot/centos6/lib/python2.7/site-packages/nose-1.1.2-py2.7.egg/nose/suite.py", line 291, in setUp
self.setupContext(ancestor)
File "/nas/home/broot/centos6/lib/python2.7/site-packages/nose-1.1.2-py2.7.egg/nose/suite.py", line 314, in setupContext
try_run(context, names)
File "/nas/home/broot/centos6/lib/python2.7/site-packages/nose-1.1.2-py2.7.egg/nose/util.py", line 478, in try_run
return func()
File "/nas/home/broot/centos6/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/testing/decorators.py", line 154, in setup_class
cls._func()
File "/nas/home/broot/centos6/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/tests/test_contour.py", line 192, in test_given_colors_levels_and_extends
plt.colorbar()
File "/nas/home/broot/centos6/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/pyplot.py", line 2234, in colorbar
ret = gcf().colorbar(mappable, cax = cax, ax=ax, **kw)
File "/nas/home/broot/centos6/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/figure.py", line 1570, in colorbar
cb = cbar.colorbar_factory(cax, mappable, **kw)
File "/nas/home/broot/centos6/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/colorbar.py", line 1338, in colorbar_factory
cb = Colorbar(cax, mappable, **kwargs)
File "/nas/home/broot/centos6/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/colorbar.py", line 905, in __init__
self.add_lines(CS)
File "/nas/home/broot/centos6/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/colorbar.py", line 948, in add_lines
erase=erase)
File "/nas/home/broot/centos6/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/colorbar.py", line 542, in add_lines
" %d vs. %d" % (len(colors), len(levels)))
ValueError: colors is not the same length as levels: 5 vs. 4
The test in question is:
@image_comparison(baseline_images=['contour_manual_colors_and_levels'],
extensions=['png'], remove_text=True)
def test_given_colors_levels_and_extends():
_, axes = plt.subplots(2, 4)
data = np.arange(12).reshape(3, 4)
colors = ['red', 'yellow', 'pink', 'blue', 'black']
levels = [2, 4, 8, 10]
for i, ax in enumerate(axes.flatten()):
plt.sca(ax)
filled = i % 2 == 0.
extend = ['neither', 'min', 'max', 'both'][i // 2]
if filled:
last_color = -1 if extend in ['min', 'max'] else None
plt.contourf(data, colors=colors[:last_color], levels=levels,
extend=extend)
else:
last_level = -1 if extend == 'both' else None
plt.contour(data, colors=colors, levels=levels[:last_level],
extend=extend)
plt.colorbar()
The text was updated successfully, but these errors were encountered:
testing with numpy 1.10rc1 revealed some bugs through their deprecation warnings. One in particular is in the interaction of contour/contourf with colorbar. It seems that add_lines() requires that inputs have the same lengths, but it does not check if this is the case. If I add in a check for this, one of our tests fails:
The test in question is:
The text was updated successfully, but these errors were encountered: