Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f4a0719

Browse files
committed
Merge branch 'v1.1.x'
2 parents ce0c0ae + d23f721 commit f4a0719

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

lib/matplotlib/pyplot.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1683,6 +1683,8 @@ def colormaps():
16831683
def colorbar(mappable=None, cax=None, ax=None, **kw):
16841684
if mappable is None:
16851685
mappable = gci()
1686+
if mappable is None:
1687+
raise RuntimeError('You must first define an image, eg with imshow')
16861688
if ax is None:
16871689
ax = gca()
16881690

@@ -1733,6 +1735,9 @@ def set_cmap(cmap):
17331735

17341736
if im is not None:
17351737
im.set_cmap(cmap)
1738+
else:
1739+
raise RuntimeError('You must first define an image, eg with imshow')
1740+
17361741
draw_if_interactive()
17371742

17381743

lib/mpl_toolkits/axes_grid1/colorbar.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -544,9 +544,8 @@ def _add_solids(self, X, Y, C):
544544
del self.solids
545545
del self.dividers
546546

547-
col = self.ax.pcolor(*args, **kw)
548-
col.set_antialiased(False) # This is to suppress artifacts. We
549-
# may use pcolormesh instead.
547+
col = self.ax.pcolormesh(*args, **kw)
548+
550549
self.solids = col
551550
if self.drawedges:
552551
self.dividers = collections.LineCollection(self._edges(X,Y),

0 commit comments

Comments
 (0)