Merge pull request #774 from ChrisRackauckas/complex
Recipe for handing arrays of complex values
This commit is contained in:
commit
a3b4b9c8b2
@ -801,12 +801,19 @@ datetimeformatter(dt) = string(convert(DateTime, dt))
|
|||||||
# -------------------------------------------------
|
# -------------------------------------------------
|
||||||
# Complex Numbers
|
# Complex Numbers
|
||||||
|
|
||||||
@userplot ComplexPlot
|
@recipe function f{T<:Number}(A::Array{Complex{T}})
|
||||||
@recipe function f(cp::ComplexPlot)
|
xguide --> "Re(x)"
|
||||||
xguide --> "Real Part"
|
yguide --> "Im(x)"
|
||||||
yguide --> "Imaginary Part"
|
real.(A), imag.(A)
|
||||||
seriestype --> :scatter
|
end
|
||||||
real(cp.args[1]), imag(cp.args[1])
|
|
||||||
|
# Splits a complex matrix to its real and complex parts
|
||||||
|
# Reals defaults solid, imaginary defaults dashed
|
||||||
|
# Label defaults are changed to match the real-imaginary reference / indexing
|
||||||
|
@recipe function f{T<:Real,T2}(x::AbstractArray{T},y::Array{Complex{T2}})
|
||||||
|
ylabel --> "Re(y)"
|
||||||
|
zlabel --> "Im(y)"
|
||||||
|
x,real.(y),imag.(y)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user