DSP.jl
DSP.jl copied to clipboard
Plotting of FilterCoefficients
I'm following up on this StatPlots.jl issue: https://github.com/JuliaPlots/StatPlots.jl/issues/147 And I'm unsure if I can re-open this DSP.jl issue: https://github.com/JuliaDSP/DSP.jl/issues/203
I have a reasonable prototype of code using RecipesBase.jl here: https://gist.github.com/standarddeviant/0e676140feca9b938943ebeded05b8e1
The main recipe handles a vector of FilterCoefficients, and there's a version that handles a single FilterCoefficients by making a length-1 vector of FilterCoefficients. I've found this useful to look at time/frequency tradeoffs when varying a single filter parameter.
If you download and run that file, this is a fun plot to make:
orders=[1,2,4,6,8,10]
plot(
digitalfilter.(
Lowpass(0.1, fs=10),
Butterworth.(orders)
),
fs=10,
desc=orders,
doimp=true,
dostep=true
)
The julia dot-syntax is wonderful :-)

I'm just offering this up as a potential solution to being able to plot and visualize filters in DSP.jl.
This does look nice. I think I'd be Ok with adding adding a dependency on RecipesBase and adding this code, but if others prefer to have it live in a dedicated package I wouldn't mind either.
@martinholters I'm happy to submit a PR to DSP.jl or create "DSPPlots.jl".
I think a RecipesBase dependency is fine, and this doesn't need to be split out into a separate package.
We now transitively depend on RecipesBase anyway (via Polynomials), so even less reason not to do this.