diff --git a/test/plot.jl b/test/plot.jl index 8943140d..4213382d 100644 --- a/test/plot.jl +++ b/test/plot.jl @@ -13,6 +13,17 @@ function plot1(X, Y; label="", width=2, xtickfontsize=12, ytickfontsize=12, lege p end +function plotxy(X, Y; xlabel="", ylabel, fig="") + if fig != "" + plt.figure(fig) + end + p = plt.plot(X, Y) + plt.xlabel(xlabel, fontsize=14); + plt.ylabel(ylabel, fontsize=14); + plt.grid(true) + plt.tight_layout() +end + function plot2(X, Y1, Y2; labels=["", ""], fig="", title="") fig_ = plt.figure(fig, figsize=(8, 6)) ax1 = plt.subplot(211) @@ -52,4 +63,32 @@ function plot3(X, Y1, Y2, Y3; labels=["", "", ""], fig="", title="") plt.xlabel("time [s]", fontsize=14) plt.xlim(0, X[end]) plt.tight_layout() +end + +function plot4(X, Y1, Y2, Y3, Y4; labels=["", "", "", ""], fig="", title="") + fig_ = plt.figure(fig, figsize=(8, 6)) + ax1 = plt.subplot(311) + plt.suptitle(title, fontsize=14) # Super title + plt.plot(X, Y1, label=labels[1]); + ylabel(labels[1], fontsize=14); + plt.grid(true) + plt.setp(ax1.get_xticklabels(), visible=false) + ax2 = plt.subplot(312, sharex = ax1) + plt.plot(X, Y2, label=labels[2]) + plt.grid(true) + ylabel(labels[2], fontsize=14); grid(true) + plt.setp(ax2.get_xticklabels(), visible=false) + ax3 = plt.subplot(313, sharex = ax1) + plt.plot(X, Y3, label=labels[3]) + plt.grid(true) + plt.ylabel(labels[3], fontsize=14); + plt.grid(true) + ax4 = plt.subplot(313, sharex = ax1) + plt.plot(X, Y4, label=labels[4]) + plt.grid(true) + plt.ylabel(labels[4], fontsize=14); + plt.grid(true) + plt.xlabel("time [s]", fontsize=14) + plt.xlim(0, X[end]) + plt.tight_layout() end \ No newline at end of file diff --git a/test/test_flightpathcontroller2.jl b/test/test_flightpathcontroller2.jl index d2c3ddd1..4f27fd7f 100644 --- a/test/test_flightpathcontroller2.jl +++ b/test/test_flightpathcontroller2.jl @@ -60,6 +60,4 @@ plot3(TIME, PSI, BETA, PSI_DOT; labels=["heading angle psi [°]", "elevation β [°]", "psi_dot [rad/s]"], fig="test_fpc2") -# p5=plot(PHI, BETA, xlabel="azimuth ϕ [°]", ylabel="elevation β [°]", width=2, xtickfontsize=12, guidefontsize=18, ytickfontsize=12, legend=false) -# pIDR5 = display(p5) # Display with InspectDR and keep plot object -# resize!(pIDR5.wnd, 1000, 700) # Resize GTK window directly +plotxy(PHI, BETA, xlabel="azimuth ϕ [°]", ylabel="elevation β [°]", fig="test_fpc2_xy")