Skip to content

Commit f013949

Browse files
issymbollike to fix axis labels
1 parent f6d15d0 commit f013949

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/solutions/solution_interface.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ DEFAULT_PLOT_FUNC(x,y,z) = (x,y,z) # For v0.5.2 bug
8383
seriestype --> :path
8484

8585
# Special case labels when vars = (:x,:y,:z) or (:x) or [:x,:y] ...
86-
if typeof(vars) <: Tuple && (typeof(vars[1]) == Symbol && typeof(vars[2]) == Symbol)
86+
if typeof(vars) <: Tuple && (issymbollike(vars[1]) && issymbollike(vars[2]))
8787
xguide --> strs[int_vars[1][2]]
8888
yguide --> strs[int_vars[1][3]]
8989
if length(vars) > 2
@@ -165,6 +165,7 @@ function cleansym(sym::Symbol)
165165
str = String(sym)
166166
replace(str,""=>".") # Fix MTK component syntax
167167
end
168+
issymbollike(x) = typeof(x) <: Symbol || Symbol(typeof(x)) == :Operation || Symbol(typeof(x)) == :Variable
168169

169170
function diffeq_to_arrays(sol,plot_analytic,denseplot,plotdensity,tspan,axis_safety,vars,int_vars,tscale,strs)
170171
if tspan === nothing
@@ -248,7 +249,7 @@ function interpret_vars(vars,sol,syms)
248249
if typeof(var) <: Union{Tuple,AbstractArray} #eltype(var) <: Symbol # Some kind of iterable
249250
tmp = []
250251
for x in var
251-
if typeof(x) <: Symbol || Symbol(typeof(x)) == :Operation || Symbol(typeof(x)) == :Variable
252+
if issymbollike(x)
252253
push!(tmp,something(findfirst(isequal(Symbol(x)), syms), 0))
253254
else
254255
push!(tmp,x)
@@ -259,7 +260,7 @@ function interpret_vars(vars,sol,syms)
259260
else
260261
var_int = tmp
261262
end
262-
elseif typeof(var) <: Symbol || Symbol(typeof(var)) == :Operation || Symbol(typeof(var)) == :Variable
263+
elseif issymbollike(var)
263264
var_int = something(findfirst(isequal(Symbol(var)), syms), 0)
264265
else
265266
var_int = var

0 commit comments

Comments
 (0)