host_subplot figure argument

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

host_subplot figure argument

Neal Becker
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: ()

_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users
Reply | Threaded
Open this post in threaded view
|

Re: host_subplot figure argument

Jerzy Karczmarczuk-2

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
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users
Reply | Threaded
Open this post in threaded view
|

Re: host_subplot figure argument

Paul Hobson-2
Hey Jerzy,


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 <[hidden email]> 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
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users

_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users
Reply | Threaded
Open this post in threaded view
|

Re: host_subplot figure argument

Jerzy Karczmarczuk-2


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


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





Avast logo

This email has been checked for viruses by Avast antivirus software.
www.avast.com





_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users