It appears you have come across a bug. As a work-around, try adding
"use_gridspec=False" to your call to fig.colorbar(). It looks like the
gridspec version of colorbars is not popping off the anchor (or panchor)
arguments and simply using hardcoded defaults. Those extra keyword
arguments get passed on to the colorbar factory function, which doesn't
recognize it and throws an exception. The gridspec code needs to pop off
the argurments, even if it isn't going to use them.
Ben Root
On Wed, Dec 10, 2014 at 6:06 PM, Yilong Wang <[email protected]> wrote:
> Hi all,
> I am using matplotlib-1.4.2, but when I try to plot a colorbar and define
> its position using argument 'anchor', it raises an error:
> TypeError: __init__() got an unexpected keyword argument 'anchor'
> Does anyone have any clue for this?
> Thank you very much!
>
> The test script is as follows:
>
> import numpy as np
> import matplotlib.pyplot as plt
>
> a=np.random.randn(100,150)
> fig,ax=plt.subplots()
> im=ax.imshow(a)
> fig.colorbar(im,anchor=(0.,0.5))
> plt.show()
>
>
>
> --
> View this message in context:
> http://matplotlib.1069221.n5.nabble.com/Missing-anchor-for-colorbar-tp44594.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> with Interactivity, Sharing, Native Excel Exports, App Integration & more
> Get technology previously reserved for billion-dollar corporations, FREE
>
> http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
> _______________________________________________
> Matplotlib-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users