python 3.x - AttributeError: 'numpy.ndarray' object has no attribute '_hold' -


I am using numpy and matplotlib in Python 3.
An error is occurring in the following code:

  import matplotlib.backends.backend_qt4agg import matplotlib import matplotlib.figure Imagery from importCan import as imagePaint and contact. Figure 2: Matplotlib.axes import matlotlib from import pylab to plpl as subplot = [1,1] b = [1,1] fsam = 48000 w, h = freqz (b, a, worn = 2000) plt.plot (( (Fsam-8000) * 0.5 / np.pi) * w, abs (h), label = "")   

Actual error with matplotlib 1.3.x: < Pre> file "/usr/local/lib/python3.2/dist-packages/matplotlib-1.3.x-py3.2-linux-x86_64.egg / matplotlib / axes.py", line 4119, if No self._hold: attribute: error: 'numpy.ndarray' object has no attribute '_hold'

Real error with Matplotlib 1.2.0:

  Traceback (most recent call final): File "/ home / christoph / audio_measurement / A UdioTools / AudioTools.py ", line 222, & lt; Module & gt; Main () file "/home/christoph/audio_measurement/AudioTools/AudioTools.py", line 216, in the main = AppForm () file "/home/christoph/audio_measurement/AudioTools/AudioTools.py", in line 39, __init__ Self.on_draw () file "/home/christoph/audio_measurement/AudioTools/AudioTools.py", line 80, self.transfer = transfer (self.canvas) file from "on_dor" /home/christoph/audio_measurement/AudioTools/Transfer.py ", In line 42, __init__ plt.plot ((fsam-8000) * 0.5 / np.pi) * w, abs (h), label =" ") file" /usr/local/lib/python3.2/ "Distro packages / matplotlib / axes.py", line 3995, if not self._hold: self.cla () AttributeError: There is no attribute '_hold' in the 'numpy.ndarray' object   < P> Location I have a look at the length of the coefficient of one and B, but they did not make any impact on the result. I did not find anything on it. Does anyone know what is going wrong?   

Normally I import matplotlib with plt.plot , plt.subplot , plt.show , etc. - or use the .plplot plt as a Even just from pylab import * . Anyway, import this sub-thumb from matlotlib.axes to

    

The reason for this is that you have an unbound Plot function ndarray is trying to work on the argument subplot needs to be done immediately This should work:

  import scipy.signal import from nppy as nppy as imported matlotlib.backends.backend_qt4agg import matplotlib.backends.backend_qt4agg from image matlotlib.figure import matplotlib.axes import from matplotlib.axes import as import Subdivision fig = Figure () ax = subplot (fig, 111) fig. AdaSpplot (ax) canvas = shape-sheeting (fig) A = [1,1] b = [1,1] fsam = 48000 w, h = freakz (b, a, varn = 2000) ax.plot ((fsam -8000) * 0.5 / np.pi) * w, abs (h), label = "") canvas.show ()    

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -