"mpl_toolkits.axisartist.floating_axes.FloatingSubplot" required option

Dear matplotlibers,

I know almost nothing about mpl_toolkits (matplolib.__version__ = 1.1.0).

From the help of

"mpl_toolkits.axisartist.floating_axes.FloatingSubplot", the init
function reads
__init__(self, fig, *args, **kwargs)

In the example here
(http://matplotlib.sourceforge.net/examples/axes_grid/demo_floating_axes.html)
the object is initialised as
FloatingSubplot(fig, rect, grid_helper=grid_helper)

If I take out 'grid_helper' I get this error:
"ValueError: FloatingAxes requires grid_helper argument"

In my understanding, **kwargs (like grid_helper) are optional
arguments and I think that 'required' options do not make much sense.
Besides its not documented in the help of the class.

Could grid_helper be upgraded to *args?

Cheers,
Francesco

Francesco,

Yes and no. In the most basic sense, the **kwargs are generally considered
as optional. However, in some very advance python code, we use the
argument unpacking features of (*args, **kwargs) to create a more agnostic
API (duck-typing for call signatures, if you will). Unfortunately, I don't
think we can update the call signature until we can drop python 2.x support.

The doc string you see when you look up FloatingSubplot is actually from
the class definition a few superclasses up. If this makes no sense, you
aren't alone... The way FloatingSubplot is made is extremely convoluted and
I am still trying to wrap my head around it. A docstring should probably
be added for the __init__ function of FloatingAxesBase so that its
constructor could be better explained.

Ben Root

ยทยทยท

On Fri, Apr 27, 2012 at 10:11 AM, Francesco Montesano < franz.bergesund@...982...> wrote:

Dear matplotlibers,

I know almost nothing about mpl_toolkits (matplolib.__version__ = 1.1.0).
>From the help of
"mpl_toolkits.axisartist.floating_axes.FloatingSubplot", the init
function reads
__init__(self, fig, *args, **kwargs)

In the example here
(
http://matplotlib.sourceforge.net/examples/axes_grid/demo_floating_axes.html
)
the object is initialised as
FloatingSubplot(fig, rect, grid_helper=grid_helper)

If I take out 'grid_helper' I get this error:
"ValueError: FloatingAxes requires grid_helper argument"

In my understanding, **kwargs (like grid_helper) are optional
arguments and I think that 'required' options do not make much sense.
Besides its not documented in the help of the class.

Could grid_helper be upgraded to *args?

Cheers,
Francesco