[SciPy-Dev] signal.freqs/freqz plot keyword
Ralf Gommers
ralf.gommers at googlemail.com
Sun Jul 18 06:44:03 EDT 2010
On Sat, Jul 17, 2010 at 10:09 PM, Ryan May <rmay31 at gmail.com> wrote:
> On Jul 17, 2010, at 4:38, Ralf Gommers <ralf.gommers at googlemail.com>
> 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.
>
Ah, that makes sense. Would indeed have been clearer with documentation.
I'll add it.
>
> > keyword should be removed or the implementation should be something like:
> > if plot:
> > try:
> > import matplotlib.pyplot as plt
> > plt.plot(w, h)
> > plt.show()
> > 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.
>
> Looks like it's been part of the signature since the functions were added,
so never mind the removing. But I still find it very inconsistent and
odd-looking.
Cheers,
Ralf
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20100718/8e7ab1cc/attachment.html>
More information about the SciPy-Dev
mailing list