From: Pierre H. <pie...@cr...> - 2013-10-22 15:41:44
|
Hi, Le 22/10/2013 12:31, Todd a écrit : > Currently, both axes.psd and axes.csd return the same thing as > mlab.psd and mlab.csd, namely the spectrum and frequency points. They > do NOT return the line object that was plotted. This is different > than specgram, which returns the AxesImage object that was plotted in > addition to the mlab.specgram return values. > > I think having access to the line object is important, so > axes.magnitude_spectrum, axes.angle_spectrum, and axes.phase_spectrum > do return the line object. I know this is inconsistent, but I think > it is very important and would strongly objefct to removing this. > > The question, then, is whether this would be a good opportunity to add > the line object to the returned values for axes.psd and axes.csd. > This would be an API break, but would be very easy to fix, and it may > be beneficial enough to warrant it. What does everyone think? I agree that it may be nice to have plt.psd/csd to return lines just like plt.plot for increased consistency. I guess that returning the values comes from Matlab style inspiration. Maybe breaking the API is too strong. In that case, adding a transitional keyword (for example `return_line=False`) to psd/csd may help introduce your new proposed behavior in a softer manner. What do you think ? Of course, for your new functions, there is no API breakage problem. best, Pierre |