Skip to content

Commit

Permalink
Support custom names in visualize(S, x, y) with group
Browse files Browse the repository at this point in the history
  • Loading branch information
tomyun committed Jul 3, 2020
1 parent af34133 commit 586c011
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/util/visualize.jl
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
visualize(S::Type{<:System}, x, y;
config=(), group=(), xstep=(),
stop=nothing, skipfirst=true, filter=nothing,
ylab=nothing, legend=nothing, plotopts...
ylab=nothing, legend=nothing, names=nothing, plotopts...
) = begin
G = configure(group)
C = @config config + !G

if isempty(G)
names = [""]
names = if !isnothing(names)
names
elseif isempty(G)
[""]
elseif G isa Vector
# temporary numeric labels
string.(1:length(G))
else
K, V = only(G)
k, v = only(V)
Expand All @@ -16,7 +21,7 @@ visualize(S::Type{<:System}, x, y;
T = K == Symbol(0) ? S : type(K)
u = fieldtype(T, k) |> unit
!isnothing(u) && (legend *= " ($u)")
names = string.(v)
string.(v)
end
isnothing(ylab) && (ylab = y)

Expand Down

0 comments on commit 586c011

Please sign in to comment.