Skip to content

Commit 2bb5d1d

Browse files
committed
improve layout
1 parent dcccc6f commit 2bb5d1d

File tree

1 file changed

+45
-16
lines changed

1 file changed

+45
-16
lines changed

src/plotting.jl

Lines changed: 45 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ function plot_polars(
628628
)
629629
# Limit y-range if CL > 10
630630
if maximum(polar_data[2]) > 10
631-
axs[1, 1].set_ylim([-0.5, 2])
631+
axs[1, 2].set_ylim([-0.5, 2])
632632
end
633633
println(label)
634634
title = raw"$C_D" * raw"$" * " vs $angle_type [°]"
@@ -637,21 +637,49 @@ function plot_polars(
637637
axs[1, 2].set_ylabel(L"$C_D$")
638638
axs[1, 2].legend()
639639
end
640-
641640

642-
# # Plot CS vs angle (if available)
643-
# plot!(res[3])
644-
# for (i, (polar_data, label)) in enumerate(zip(polar_data_list, label_list))
645-
# # Check if CS data is available (length > 3)
646-
# if length(polar_data) > 3
647-
# style = i ≤ n_solvers ? (:solid, :star, 7) : (:solid, :circle, 5)
648-
# plot!(res[3], polar_data[1], polar_data[4],
649-
# label=label, linestyle=style[1], marker=style[2], markersize=style[3])
650-
# end
651-
# end
652-
# title!(res[3], L"C_S \textrm{ vs } %$angle_type")
653-
# xlabel!(res[3], "$angle_type [deg]")
654-
# ylabel!(res[3], L"C_S")
641+
642+
for (i, (polar_data, label)) in enumerate(zip(polar_data_list, label_list))
643+
if i < n_solvers
644+
linestyle = "-"
645+
marker = "*"
646+
markersize = 7
647+
else
648+
linestyle = "-"
649+
marker = "."
650+
markersize = 5
651+
end
652+
if contains(label, "LLT")
653+
label = replace(label, "e5" => raw"\cdot10^5")
654+
label = replace(label, " " => raw"~")
655+
label = replace(label, "LLT" => raw"\mathrm{LLT}{~\,}")
656+
label = raw"$" * label * raw"$"
657+
else
658+
label = replace(label, "e5" => raw"\cdot10^5")
659+
label = replace(label, " " => "~")
660+
label = replace(label, "VSM" => raw"\mathrm{VSM}")
661+
label = raw"$" * label * raw"$"
662+
end
663+
axs[2, 1].plot(
664+
polar_data[1],
665+
polar_data[4],
666+
label=label,
667+
linestyle=linestyle,
668+
marker=marker,
669+
markersize=markersize,
670+
)
671+
# Limit y-range if CL > 10
672+
if maximum(polar_data[2]) > 10
673+
axs[2, 1].set_ylim([-0.5, 2])
674+
end
675+
println(label)
676+
title = raw"$C_S" * raw"$" * " vs $angle_type [°]"
677+
axs[2, 1].set_title(title)
678+
axs[2, 1].set_xlabel("$angle_type [°]")
679+
axs[2, 1].set_ylabel(L"$C_S$")
680+
axs[2, 1].legend()
681+
end
682+
655683

656684
# # Plot CL vs CD
657685
# plot!(res[4])
@@ -674,7 +702,8 @@ function plot_polars(
674702
# if is_save
675703
# save_plot(res, save_path, title, data_type=data_type)
676704
# end
677-
705+
706+
fig.tight_layout(h_pad=2.5, rect=(0.01,0.01,0.99,0.99))
678707
if is_show
679708
show_plot(fig)
680709
end

0 commit comments

Comments
 (0)