JuliaControl / ControlSystems.jl

A Control Systems Toolbox for Julia
https://juliacontrol.github.io/ControlSystems.jl/stable/
Other
503 stars 85 forks source link

bodeplot does not work well with plotlyjs backend #875

Closed fibonatic closed 9 months ago

fibonatic commented 10 months ago

I am using Julia 1.9.3, ControlSystems v1.8.0 and Plots v1.39.0. The Bode plots are wrong when using the plotlyjs backend.

I used the following code the obtain the attached image:

using ControlSystems, Plots
plotlyjs()
bodeplot(tf(1,[1,0.5,1]))

Untitled

fibonatic commented 10 months ago

I am able to recreate the same incorrect plot in Julia 1.8.5, ControlSystems v1.7.2 and Plots v1.38.10.

baggepinnen commented 10 months ago

strange, the plot appears fine here (except for some ugliness in the tick labels) with the same versions of CS and Plots image

how does it look with other plotting backends?

fibonatic commented 10 months ago

I have tested a couple of different backends (GR, Plotly, PGFPlotsX, UnicodePlots and InspectDR) and all seem to be working OK. I also tried to remove and reinstall Plots, which did not change the plot result when using PlotslyJS. Then I also removed and reinstall PlotslyJS, which did not change the plot result.

fibonatic commented 10 months ago

FYI: the figure does look OK when only plotting the magnitude, so using: bodeplot(tf(1,[1,0.5,1]), plotphase=false)

baggepinnen commented 10 months ago

Hmm, I don't think there's anything we can do here then, it must be a bug in either PlotlyJS or the backend code to glue it together with Plots.jl