From edec8a6101e4373ecaeb1018996e4ce85184dc2c Mon Sep 17 00:00:00 2001 From: Uwe Fechner Date: Fri, 15 Mar 2024 18:25:38 +0100 Subject: [PATCH] add plot3() --- test/plot.jl | 22 ++++++++++++++++++++++ test/test_flightpathcontroller1.jl | 4 ++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/test/plot.jl b/test/plot.jl index 0a05b011..e59769ae 100644 --- a/test/plot.jl +++ b/test/plot.jl @@ -28,4 +28,26 @@ function plot2(X, Y1, Y2; labels=["", ""], fig="", title="") xlabel("time [s]", fontsize=14) xlim(0, X[end]) tight_layout() +end + +function plot3(X, Y1, Y2, Y3; labels=["", "", ""], fig="", title="") + fig_ = PyPlot.figure(fig, figsize=(8, 6)) + ax1 = PyPlot.subplot(311) + 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(312, sharex = ax1) + PyPlot.plot(X, Y2, label=labels[2]) + PyPlot.grid(true) + ylabel(labels[2], fontsize=14); grid(true) + setp(ax2.get_xticklabels(), visible=false) + ax3 = PyPlot.subplot(313, sharex = ax1) + PyPlot.plot(X, Y3, label=labels[3]) + PyPlot.grid(true) + ylabel(labels[3], fontsize=14); grid(true) + xlabel("time [s]", fontsize=14) + xlim(0, X[end]) + tight_layout() end \ No newline at end of file diff --git a/test/test_flightpathcontroller1.jl b/test/test_flightpathcontroller1.jl index 91cc8247..129557ae 100644 --- a/test/test_flightpathcontroller1.jl +++ b/test/test_flightpathcontroller1.jl @@ -42,8 +42,8 @@ end include("plot.jl") -plot2(TIME, PSI, BETA; labels=["heading angle psi [°]","elevation β [°]"], +plot3(TIME, PSI, BETA, PSI_DOT; + labels=["heading angle psi [°]","elevation β [°]", "psi_dot [rad/s]"], fig = "test_fpc1") -# p3 = plot1(TIME, PSI_DOT, label="psi_dot [rad/s]", fig = "psi_dot") # return TIME, PSI, BETA, PHI, PSI_DOT \ No newline at end of file