Skip to content

Commit 20ed7ea

Browse files
committed
workaround for JuliaPlots/Plots.jl#5092
1 parent 6571b48 commit 20ed7ea

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

lib/ControlSystemsBase/src/plotting.jl

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,6 @@ _span(vec) = -(reverse(extrema(vec))...)
290290
# xticks --> getLogTicks(ws, getlims(:xlims, plotattributes, ws))
291291
grid --> true
292292

293-
link --> :x
294-
295293
for (si,s) = enumerate(systems)
296294
if balance
297295
sbal = balance_statespace(s)[1]
@@ -319,6 +317,7 @@ _span(vec) = -(reverse(extrema(vec))...)
319317
continue
320318
end
321319
phasedata = vec(phase[i, j, :])
320+
local inds
322321
@series begin
323322
yscale --> _PlotScaleFunc
324323
xscale --> :log10
@@ -351,6 +350,10 @@ _span(vec) = -(reverse(extrema(vec))...)
351350
end
352351
end
353352

353+
if eltype(phasedata) <: AbstractFloat
354+
link --> :x # To guard agains https://github.com/JuliaPlots/Plots.jl/issues/5092 when using uncertain number systems
355+
end
356+
354357
@series begin
355358
xscale --> :log10
356359
# ylims := ylimsphase
@@ -361,8 +364,10 @@ _span(vec) = -(reverse(extrema(vec))...)
361364
label --> ""
362365
group --> group_ind
363366
phasedata = unwrap ? ControlSystemsBase.unwrap(phasedata.*(pi/180)).*(180/pi) : phasedata
364-
if adaptive
367+
if adaptive && eltype(phasedata) <: AbstractFloat # To guard agains https://github.com/JuliaPlots/Plots.jl/issues/5092 when using uncertain number systems
365368
downsample(ws, phasedata, _span(phasedata)/500)[1:2]
369+
elseif adaptive
370+
ws[inds], phasedata[inds]
366371
else
367372
ws, phasedata
368373
end

0 commit comments

Comments
 (0)