Skip to content

Commit

Permalink
Bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ufechner7 committed Aug 24, 2024
1 parent 74c3960 commit 6829a5b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion examples/multi-channel-many.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ Y5 = 0.2*sin.(3T)
Y6 = 0.2*cos.(3T)
Y7 = 0.2*sin.(4T)
plotx(T, Y1, Y2, Y3, Y4, Y5, Y6, Y7; ylabels=["sin","cos", "0.2sin(2T)", "0.2cos(2T)", "0.2sin(3T)", "0.2cos(3T)", "0.2sin(4T)", "0.2cos(4T)"],
yzoom=0.9, fig="multi-channel")
yzoom=0.9, fig="multi-channel")
5 changes: 3 additions & 2 deletions src/ControlPlots.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ mutable struct PlotX
xlabel
ylabels
ysize
yzoom
xlims
ylims
ann
Expand Down Expand Up @@ -48,7 +49,7 @@ function plotxy(X, Y; xlabel="", ylabel="", xlims=nothing, ylims=nothing, ann=no
plt.grid(which="major", color="#DDDDDD")
plt.tight_layout()
end
PlotX(X, Y, nothing, xlabel, ylabel, ysize, xlims, ylims, ann, scatter, fig, 3)
PlotX(X, Y, nothing, xlabel, ylabel, ysize, nothing, xlims, ylims, ann, scatter, fig, 3)
end

function display(P::PlotX)
Expand All @@ -57,7 +58,7 @@ function display(P::PlotX)
scatter=P.scatter, fig=P.fig, ysize=P.ysize, disp=true)
elseif P.type == 2
plotx(P.X, P.Y...; xlabel=P.xlabel, ylabels=P.ylabels, labels=P.labels, xlims=P.xlims, ylims=P.ylims, ann=P.ann,
scatter=P.scatter, fig=P.fig, ysize=P.ysize, disp=true)
scatter=P.scatter, fig=P.fig, ysize=P.ysize, yzoom=P.yzoom, disp=true)
elseif P.type == 3
plotxy(P.X, P.Y; xlabel=P.xlabel, ylabel=P.ylabels, xlims=P.xlims, ylims=P.ylims, ann=P.ann,
scatter=P.scatter, fig=P.fig, ysize=P.ysize, disp=true)
Expand Down
8 changes: 4 additions & 4 deletions src/plot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function plot(X, Ys::AbstractVector{<:AbstractVector}; xlabel="", ylabel="",
else
println("OK")
end
PlotX(X, Ys, labels, xlabel, ylabel, ysize, xlims, ylims, ann, scatter, fig, 4)
PlotX(X, Ys, labels, xlabel, ylabel, ysize, nothing, xlims, ylims, ann, scatter, fig, 4)
end

function plot(X, Y1::AbstractVector{<:AbstractVector}, Y2::AbstractVector{<:Number};
Expand Down Expand Up @@ -83,7 +83,7 @@ function plot(X, Y1::AbstractVector{<:AbstractVector}, Y2::AbstractVector{<:Numb
else
println("OK")
end
PlotX(X, [Y1, Y2], labels, xlabel, ylabels, ysize, xlims, ylims, ann, scatter, fig, 5)
PlotX(X, [Y1, Y2], labels, xlabel, ylabels, ysize, nothing, xlims, ylims, ann, scatter, fig, 5)
end

end
Expand Down Expand Up @@ -128,7 +128,7 @@ function plot(X, Y1::AbstractVector{<:Number}, Y2::AbstractVector{<:Number};
else
println("OK")
end
PlotX(X, [Y1, Y2], labels, xlabel, ylabels, ysize, xlims, ylims, ann, scatter, fig, 5)
PlotX(X, [Y1, Y2], labels, xlabel, ylabels, ysize, nothing, xlims, ylims, ann, scatter, fig, 5)
end

function plot(Y::AbstractVector{<:Number}; xlabel="", ylabel="", fig="", ysize=14, disp=false)
Expand Down Expand Up @@ -165,6 +165,6 @@ function plot(X, Y::AbstractVector{<:Number}; xlabel="", ylabel="", xlims=nothin
plt.grid(which="major", color="#DDDDDD")
plt.tight_layout()
end
PlotX(X, Y, nothing, xlabel, ylabel, ysize, xlims, ylims, ann, scatter, fig, 1)
PlotX(X, Y, nothing, xlabel, ylabel, ysize, nothing, xlims, ylims, ann, scatter, fig, 1)
end

4 changes: 2 additions & 2 deletions src/plotx.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function plotx(X, Y...; xlabel="time [s]", ylabels=nothing, labels=nothing, xlims=nothing, ylims=nothing, ann=nothing,
scatter=false, fig="", title="", ysize=14, yzoom=0.9, disp=false)
scatter=false, fig="", title="", ysize=14, yzoom=1.0, disp=false)
if disp
len=length(Y)
fig_ = plt.figure(fig, figsize=(8, len*2*yzoom))
Expand Down Expand Up @@ -58,5 +58,5 @@ function plotx(X, Y...; xlabel="time [s]", ylabels=nothing, labels=nothing, xlim

plt.tight_layout()
end
PlotX(collect(X), Y, labels, xlabel, ylabels, ysize, xlims, ylims, ann, scatter, fig, 2)
PlotX(collect(X), Y, labels, xlabel, ylabels, ysize, yzoom, xlims, ylims, ann, scatter, fig, 2)
end

0 comments on commit 6829a5b

Please sign in to comment.