Negative phase margins are displayed as positive for systems with negative phase margin in function ´margin()´. Function ´marginplot()´gives correct (negative) value.
Example:
P=tf(1,[5, 10.25, 6.25, 1])
w_180, gm, w_c, pm = margin(50P)
results in gm = 35.08
For the same system, marginplot(50P)'s result is
Pm: [-35.08]
I believe the bug occurs in line 509 of file analysis.jl that computes gm as
abs.(pm)