Skip to content

Commit

Permalink
Merge pull request #53 from SimonEnsemble/patch_docs
Browse files Browse the repository at this point in the history
allow viz poles zero to change legend position
  • Loading branch information
SimonEnsemble authored Jun 1, 2024
2 parents 8dd41ce + 7cefaea commit 7f21534
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/viz.jl
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,20 @@ plot the zeros and poles of the transfer function `g` in the complex plane.
returns a `CairoMakie.jl` `Figure` object for further modification.
"""
function viz_poles_and_zeros(tf::TransferFunction; savename::Union{Nothing, String}=nothing, title::String="poles and zeros")
function viz_poles_and_zeros(
tf::TransferFunction;
savename::Union{Nothing, String}=nothing,
title::String="poles and zeros",
legend_position::Symbol=:rc
)
z, p, k = zeros_poles_gain(tf)

fig = Figure()
ax = Axis(fig[1, 1], xlabel="Re", ylabel="Im", title=title)
draw_axes(ax)
scatter!(real.(z), imag.(z), marker=:circle, label="zeros", markersize=15)
scatter!(real.(p), imag.(p), marker=:x, label="poles", markersize=15)
axislegend()
axislegend(position=legend_position)
if ! isnothing(savename)
save(savename, fig, px_per_unit=1)
end
Expand Down

0 comments on commit 7f21534

Please sign in to comment.