tone down recipe
This commit is contained in:
parent
0be0824207
commit
3e7dd9bb77
@ -810,30 +810,10 @@ end
|
|||||||
# Splits a complex matrix to its real and complex parts
|
# Splits a complex matrix to its real and complex parts
|
||||||
# Reals defaults solid, imaginary defaults dashed
|
# Reals defaults solid, imaginary defaults dashed
|
||||||
# Label defaults are changed to match the real-imaginary reference / indexing
|
# Label defaults are changed to match the real-imaginary reference / indexing
|
||||||
@recipe function f{T<:Real,T2<:Number}(x::AbstractArray{T},y::Array{Complex{T2}};
|
@recipe function f{T<:Real,T2}(x::AbstractArray{T},y::Array{Complex{T2}})
|
||||||
transformation=:split2D)
|
ylabel --> "Re(y)"
|
||||||
if transformation==:split2D
|
zlabel --> "Im(y)"
|
||||||
A = real.(y)
|
x,real.(y),imag.(y)
|
||||||
B = imag.(y)
|
|
||||||
_y = [!iseven(i) ? A[:,i÷2+1] : B[:,i÷2] for i in 1:2size(A,2)]
|
|
||||||
linestyle --> reshape([!iseven(i) ? :solid : :dash for i in 1:2size(A,2)],1,2size(A,2))
|
|
||||||
label --> reshape([!iseven(i) ? "Re(y$(i÷2+1))" : "Im(y$(i÷2))" for i in 1:2size(A,2)],1,2size(A,2))
|
|
||||||
color --> reshape([!iseven(i) ? i÷2+1 : i÷2 for i in 1:2size(A,2)],1,2size(A,2))
|
|
||||||
retval = (x,_y)
|
|
||||||
elseif transformation==:split3D
|
|
||||||
A = real.(y)
|
|
||||||
B = imag.(y)
|
|
||||||
ylabel --> "Re(y)"
|
|
||||||
zlabel --> "Im(y)"
|
|
||||||
retval = (x,A,B)
|
|
||||||
elseif transformation==:modulus
|
|
||||||
_y = norm.(y)
|
|
||||||
label --> reshape(["||y$(i)||" for i in 1:size(_y,2)],1,size(_y,2))
|
|
||||||
retval = (x,_y)
|
|
||||||
else
|
|
||||||
error("Transformation unknown. Please use :split2D, :split3D, or :modulus")
|
|
||||||
end
|
|
||||||
(retval...)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user