LCAV / pyroomacoustics

Pyroomacoustics is a package for audio signal processing for indoor applications. It was developed as a fast prototyping platform for beamforming algorithms in indoor scenarios.
https://pyroomacoustics.readthedocs.io
MIT License
1.33k stars 417 forks source link

issues plotting 3d room.. #306

Closed rorywalsh closed 1 year ago

rorywalsh commented 1 year ago

I'm having issues plotting a 3D room? Here is my simple script:

import numpy as np
import matplotlib.pyplot as plt
import pyroomacoustics as pra

corners = np.array([[0,0], [0,3], [5,3], [5,1], [3,1], [3,0]]).T  # [x,y]
room = pra.Room.from_corners(corners)
room.extrude(2.)

fig, ax = room.plot()
plt.show()

and the output:

λ python3 test2.py 
Traceback (most recent call last):
  File "test2.py", line 9, in <module>
    fig, ax = room.plot()
  File "C:\Python36\lib\site-packages\pyroomacoustics\room.py", line 1657, in plot
    ax = a3.Axes3D(fig, auto_add_to_figure=False)
  File "C:\Python36\lib\site-packages\mpl_toolkits\mplot3d\axes3d.py", line 106, in __init__
    fig, rect, frameon=True, box_aspect=box_aspect, *args, **kwargs
  File "C:\Python36\lib\site-packages\matplotlib\axes\_base.py", line 525, in __init__
    self.update(kwargs)
  File "C:\Python36\lib\site-packages\matplotlib\artist.py", line 996, in update
    raise AttributeError(f"{type(self).__name__!r} object "
AttributeError: 'Axes3D' object has no property 'auto_add_to_figure'

Further info:

λ pip3 show matplotlib
Name: matplotlib
Version: 3.3.4
Summary: Python plotting package
Home-page: https://matplotlib.org
Author: John D. Hunter, Michael Droettboom
Author-email: matplotlib-users@python.org
License: PSF
Location: c:\python36\lib\site-packages
Requires: cycler, kiwisolver, numpy, pillow, pyparsing, python-dateutil
Required-by:

λ pip3 show numpy
Name: numpy
Version: 1.19.5
Summary: NumPy is the fundamental package for array computing with Python.
Home-page: https://www.numpy.org
Author: Travis E. Oliphant et al.
Author-email:
License: BSD
Location: c:\python36\lib\site-packages
Requires:
Required-by: bokeh, datashape, h5py, imageio, Keras, matplotlib, numexpr, odo, pandas, pyroomacoustics, PyWavelets, scipy, tables, tensorflow, tensorflow-tensorboard

λ pip3 show scipy
Name: scipy
Version: 1.5.4
Summary: SciPy: Scientific Library for Python
Home-page: https://www.scipy.org
Author:
Author-email:
License: BSD
Location: c:\python36\lib\site-packages
Requires: numpy
Required-by: Keras, pyroomacoustics

λ pip3 show pybind11
Name: pybind11
Version: 2.10.3
Summary: Seamless operability between C++11 and Python
Home-page: https://github.com/pybind/pybind11
Author: Wenzel Jakob
Author-email: wenzel.jakob@epfl.ch
License: BSD
Location: c:\python36\lib\site-packages
Requires:
Required-by: pyroomacoustics

any ideas?

rorywalsh commented 1 year ago

Ok, I managed to get this running on my laptop. I still can't get it to run on my desktop, with similar tools installed, so any help would be much appreciated.

hhhuxy commented 1 year ago

Hi bro, I have exactly the same problem as u did. I suspect that it's because of the wrong version of matplotlib. Could u tell me which version is it on your laptop that can work? Maybe I'll try it.

rorywalsh commented 1 year ago

Sure, I have 3.7.0. Can you let me know if that does the trick?

fakufaku commented 1 year ago

I also suspect the python version may be the problem. It looks like you have 3.6 on your desktop. Python 3.6 has reached end of life and is not officially supported (in general, and by pyroomacoustics too). It is possible that matplotlib itself does not support 3.6.

hhhuxy commented 1 year ago

I also suspect the python version may be the problem. It looks like you have 3.6 on your desktop. Python 3.6 has reached end of life and is not officially supported (in general, and by pyroomacoustics too). It is possible that matplotlib itself does not support 3.6.

Thank u so much! u r right, it's working well with python 3.9 and matplotlib 3.7.0

rorywalsh commented 1 year ago

Great, I'll update accordingly on my desktop machines 👍