Skip to content

[Bug]: AttributeError: 'FigureCanvasInterAgg' object has no attribute 'tostring_rgb'. Did you mean: 'tostring_argb'? #30735

@Diegomendes0706

Description

@Diegomendes0706

Bug summary

Using matplotlib on pycharm, this error :

AttributeError: 'FigureCanvasInterAgg' object has no attribute 'tostring_rgb'. Did you mean: 'tostring_argb'?

Only on powershell, using CMD it works

matplotlib error.pdf

Code for reproduction

import control as ct
import matplotlib.pyplot as plt

# Define the transfer function
sys = ct.TransferFunction([1], [1, 10.4, 16+19.2+12, 128+28.8, 192])

# Calculate and plot the root locus
roots, gains = ct.root_locus(sys, plot=True)
plt.show()

Actual outcome

warnings.warn(
Ignoring fixed x limits to fulfill fixed data aspect with adjustable data limits.
Traceback (most recent call last):
File "C:\Users\diego\OneDrive\Documentos\faculdade\controle automatico\sistemas de controle\lista 4\q6.py", line 9, in
plt.show()
File "C:\Users\diego\OneDrive\Documentos\faculdade\controle automatico\sistemas de controle.venv\Lib\site-packages\matplotlib\pyplot.py", line 614, in show
return _get_backend_mod().show(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\JetBrains\PyCharm 2024.1.3\plugins\python\helpers\pycharm_matplotlib_backend\backend_interagg.py", line 41, in call
manager.show(**kwargs)
File "C:\Program Files\JetBrains\PyCharm 2024.1.3\plugins\python\helpers\pycharm_matplotlib_backend\backend_interagg.py", line 144, in show
self.canvas.show()
File "C:\Program Files\JetBrains\PyCharm 2024.1.3\plugins\python\helpers\pycharm_matplotlib_backend\backend_interagg.py", line 85, in show
buffer = self.tostring_rgb()
^^^^^^^^^^^^^^^^^
AttributeError: 'FigureCanvasInterAgg' object has no attribute 'tostring_rgb'. Did you mean: 'tostring_argb'?

Expected outcome

ploting

Additional information

works on CMD

Operating system

Windows 11

Matplotlib Version

3.10.6

Matplotlib Backend

module://backend_interagg

Python version

Python 3.12.1

Jupyter version

No response

Installation

pip

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