X Tutup
Skip to content

[subplot2grid] TypeError when using "fig" argument #8907

@suuuehgi

Description

@suuuehgi

Bug report

Bug summary

matplotlib.pyplot.subplot2grid fails with TypeError when given a figure-argument.

Code for reproduction

import matplotlib.pyplot as plt

f = plt.figure()
ax1 = plt.subplot2grid((2, 2), (0, 0), colspan=2, fig=f)

It even fails for this:

import matplotlib.pyplot as plt

ax1 = plt.subplot2grid((2, 2), (0, 0), colspan=2, fig=None)

Actual outcome

Traceback (most recent call last):
  File "filename.py", line 4, in <module>
    ax1 = plt.subplot2grid((2, 2), (0, 0), colspan=2, fig=f)
  File "/usr/lib/python3.6/site-packages/matplotlib/pyplot.py", line 1292, in subplot2grid
    a = fig.add_subplot(subplotspec, **kwargs)
  File "/usr/lib/python3.6/site-packages/matplotlib/figure.py", line 1021, in add_subplot
    a = subplot_class_factory(projection_class)(self, *args, **kwargs)
TypeError: __init__() got multiple values for argument 'fig'

Matplotlib version

  • Operating System: 4.11.6-3-ARCH
  • Matplotlib Version: 2.0.2
  • Python Version: 3.6.1
  • Jupyter Version (if applicable): ---
  • Other Libraries: ---

Installed via official repositories.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      X Tutup