Skip to content

Commit

Permalink
better plotting
Browse files Browse the repository at this point in the history
  • Loading branch information
Uwe Fechner committed Mar 15, 2024
1 parent bc98e79 commit 04bc6e3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
17 changes: 17 additions & 0 deletions test/plot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,21 @@ function plot1(X, Y; label="", width=2, xtickfontsize=12, ytickfontsize=12, lege
p = PyPlot.plot(X, Y; label)
PyPlot.grid(true)
p
end

function plot2(X, Y1, Y2; labels=["", ""], fig="", title="")
fig_ = PyPlot.figure(fig, figsize=(8, 6))
ax1 = PyPlot.subplot(211)
PyPlot.suptitle(title, fontsize=14) # Super title
PyPlot.plot(X, Y1, label=labels[1]);
ylabel(labels[1], fontsize=14);
PyPlot.grid(true)
setp(ax1.get_xticklabels(), visible=false)
ax2 = PyPlot.subplot(212, sharex = ax1)
PyPlot.plot(X, Y2, label=labels[2])
PyPlot.grid(true)
ylabel(labels[2], fontsize=14); grid(true)
xlabel("time [s]", fontsize=14)
xlim(0, X[end])
tight_layout()
end
6 changes: 3 additions & 3 deletions test/test_flightpathcontroller1.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ end

include("plot.jl")

p1 = plot1(TIME, PSI; label="heading angle psi [°]", fig = "heading")
p2 = plot1(TIME, BETA, label="elevation β [°]", fig = "elevation")
p3 = plot1(TIME, PSI_DOT, label="psi_dot [rad/s]", fig = "psi_dot")
plot2(TIME, PSI, BETA; labels=["heading angle psi [°]","elevation β [°]"],
fig = "test_fpc1")
# p3 = plot1(TIME, PSI_DOT, label="psi_dot [rad/s]", fig = "psi_dot")

# return TIME, PSI, BETA, PHI, PSI_DOT

0 comments on commit 04bc6e3

Please sign in to comment.