Closed
Description
The figure api documentation of colorbar
lists anchor
and panchor
as
possible arguments to figure.colorbar()
. However they do not seem to exist anymore.
E.g. when running the following in matplotlib 2.0:
import matplotlib.pyplot as plt
import numpy as np; np.random.seed(1)
fig, ax = plt.subplots()
im = ax.imshow(np.random.rand(11,16))
ax.set_xlabel("x label")
fig.colorbar(im, ax=ax, anchor=(0.0, 0.5))
plt.show()
the following error is thrown:
Traceback (most recent call last):
File "D:\⬜⬜⬜⬜\⬜⬜⬜\⬜⬜⬜\python\test\SO_colorbar.py", line 15, in <module>
fig.colorbar(im, ax=ax, anchor=(0.0, 0.5))
File "c:\⬜⬜⬜⬜\⬜⬜⬜⬜\python-2.7.10.amd64\lib\site-packages\matplotlib\figure.py", line 1602, in colorbar
cb = cbar.colorbar_factory(cax, mappable, **kw)
File "c:\⬜⬜⬜⬜\⬜⬜⬜⬜\python-2.7.10.amd64\lib\site-packages\matplotlib\colorbar.py", line 1347, in colorbar_factory
cb = Colorbar(cax, mappable, **kwargs)
File "c:\⬜⬜⬜⬜\⬜⬜⬜⬜\\python-2.7.10.amd64\lib\site-p
5B03
ackages\matplotlib\colorbar.py", line 926, in __init__
ColorbarBase.__init__(self, ax, **kw)
TypeError: __init__() got an unexpected keyword argument 'anchor'
I could imaging that this is simply because the documentation has not been updated?!