Matplotlib's figure() causes type checker warning in PyCharm 2026.1.3

I recently updated Matplotlib from 3.10.8 to 3.11.0 in one of my projects. Since the change, PyCharm has been throwing a type checker warning for code such as this:

import matplotlib.pyplot as plt

plt.figure(figsize=(12, 6))

The warning PyCharm gives is:

Expected type 'float', got 'tuple[Literal[12], Literal[6]]' instead

It wasn't immediately clear whether this was a Matplotlib or a PyCharm issue, but the Matplotlib developers think it's related to PyCharm: https://github.com/matplotlib/matplotlib/issues/31964

Google AI suggested invalidating the cache, but this did not resolve the warnings.

0

Hi Danny

 

Thank you for this detailed escalation.

I have raised this as a new bug in youtrack:

https://youtrack.jetbrains.com/issue/PY-90631/Type-checker-warning-for-plt.figure-in-PyCharm-2026.1.3

I would suggest we follow up the investigation/fix steps there and close this for not having a duplicate channel.

 

Kind regards,

0

请先登录再写评论。