[SciPy-Dev] signal.freqs/freqz plot keyword
Sat Jul 17 09:09:48 CDT 2010
On Jul 17, 2010, at 4:38, Ralf Gommers <firstname.lastname@example.org> wrote:
> freqs/freqz have a keyword plot=None, which if True does this:
> if not plot is None:
> plot(w, h)
> while plot is not even defined.
If it's not none, it should be a callable passed in, which let's you seine your own plotting function. Actually using matplotlib's plot produces unexpected results, you end up plotting the real part of the complex transfer function, not the magnitude. This actually bit me recently and should probably be documented.
> keyword should be removed or the implementation should be something like:
> if plot:
> import matplotlib.pyplot as plt
> plt.plot(w, h)
> except ImportError:
> warnings.warn("`plot` is True, but can't import matplotlib.pyplot.")
No, you can use any plotting library right now.
> Removal makes more sense I think, since scipy does not depend on matplotlib. And why provide a plot keyword in these functions and not in many others where it would also make sense?
It's mimmicking MATLAB functionality, which will plot the transfer function if you call freqz and don't save the results.
More information about the SciPy-Dev