[Matplotlib-users] host_subplot figure argument

I tried to use host_subplot with a figure argument. Why does this fail?

···

import matplotlib.pyplot as plt
fig,ax = plt.subplots()
host = host_subplot(figure=fig)


ValueError: Illegal argument(s) to subplot: ()

Please, why don’t you read the docs?..
Where have you found the fig parameter?

  1. You never mention the parasite axes etc., so perhaps simple add_subplot might be convenient.

  2. Anyway, both, subplot, and
    from mpl_toolkits.axes_grid1 import host_subplot
    share the geometry parameters, say 221 (columns, rows, which).

  3. Look e.g., here:

    or here:

And most probably a dozen more.

Jerzy Karczmarczuk
/Caen, France/

···

https://matplotlib.org/gallery/axisartist/demo_parasite_axes2.html?highlight=host_subplot
https://stackoverflow.com/questions/33396190/what-are-the-parameters-of-host-subplot-in-matplotlibs-mpl-toolkits-axes-grid1

Hey Jerzy,

The “figure” parameter to host_subplot is documented here: https://matplotlib.org/api/_as_gen/mpl_toolkits.axes_grid1.parasite_axes.host_subplot.html#mpl_toolkits.axes_grid1.parasite_axes.host_subplot

Based on that page, I think it’s safe to say that the OP did read the docs. It’s just not at all clear that additional Axes creation args need to be passed.
-Paul

···

On Wed, Jun 10, 2020 at 1:52 PM Jerzy Karczmarczuk <jerzy.karczmarczuk@unicaen.fr> wrote:

Le 10/06/2020 à 20:15, Neal Becker a écrit :

I tried to use host_subplot with a figure argument. Why does this fail?

import matplotlib.pyplot as plt
fig,ax = plt.subplots()
host = host_subplot(figure=fig) ## of course, import is missing… (JK)


ValueError: Illegal argument(s) to subplot: ()

Please, why don’t you read the docs?..
Where have you found the fig parameter?

  1. You never mention the parasite axes etc., so perhaps simple add_subplot might be convenient.

  2. Anyway, both, subplot, and
    from mpl_toolkits.axes_grid1 import host_subplot
    share the geometry parameters, say 221 (columns, rows, which).

  3. Look e.g., here:

    https://matplotlib.org/gallery/axisartist/demo_parasite_axes2.html?highlight=host_subplot
    or here:
    https://stackoverflow.com/questions/33396190/what-are-the-parameters-of-host-subplot-in-matplotlibs-mpl-toolkits-axes-grid1

And most probably a dozen more.

Jerzy Karczmarczuk
/Caen, France/


Matplotlib-users mailing list
Matplotlib-users@python.org
https://mail.python.org/mailman/listinfo/matplotlib-users

On 11/06/2020 1:03 am, Paul Hobson corrects my answer to Neal Baker:
[[[ /Where have you found //the fig parameter? ]]]/*/
/*
*/
/*

The "figure" parameter to host_subplot is documented here: https://matplotlib.org/api/_as_gen/mpl_toolkits.axes_grid1.parasite_axes.host_subplot.html#mpl_toolkits.axes_grid1.parasite_axes.host_subplot

Based on that page, I think it's safe to say that the OP did read the docs. It's just not at all clear that additional Axes creation args need to be passed.

Yes, sorry for being superficial ad a bit /ad hominem/. Thank you very much for pointing this out, sincerely.

But "reading the docs" rarely can be reduced to reading just one concerned page. In the page you refer to, *there are others arguments*, passed to an Axis, where - as mentioned - *subplot will be added*. Perhaps it is not clear if somebody has never seen subplots before, but this is a question of common sense...

Subplots are very thorougly discussed in many places. If somebody knows anything about the subplots, he/she should know that it must be /*positioned*/ somehow, isn't it? (The Figure arg is redundant, though, as the default is there).

Best regards.

Jerzy Karczmarczuk

···

--
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus