Skip to content

Commit ea8e5f7

Browse files
committed
plot_distribution() completed
1 parent 187e217 commit ea8e5f7

File tree

1 file changed

+28
-33
lines changed

1 file changed

+28
-33
lines changed

src/plotting.jl

Lines changed: 28 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -351,48 +351,43 @@ function plot_distribution(y_coordinates_list, results_list, label_list;
351351

352352
# Force Components
353353
for (idx, component) in enumerate(["x", "y", "z"])
354-
println(idx)
355-
println(component)
356354
axs[3, idx].set_title("Force in $component direction", size=16)
357355
axs[3, idx].set_xlabel(L"Spanwise Position $y/b$")
358356
axs[3, idx].set_ylabel(raw"$F_\mathrm" * "{$component}" * raw"$")
357+
for (y_coords, results, label) in zip(y_coordinates_list, results_list, label_list)
358+
# Extract force components for the current direction (idx)
359+
forces = results["F_distribution"][idx, :]
360+
# Verify dimensions match
361+
if length(y_coords) != length(forces)
362+
@warn "Dimension mismatch in force plotting" length(y_coords) length(forces) component
363+
continue # Skip this component instead of throwing error
364+
end
365+
space=""
366+
if label == "LLT"
367+
space = "~"
368+
end
369+
axs[3, idx].plot(
370+
y_coords,
371+
forces,
372+
label = "$label" * space * raw"$~\Sigma~F_\mathrm" * "{$component}:~" *
373+
raw"$" * "$(round(results["F$component"], digits=2)) N"
374+
)
375+
axs[3, idx].legend()
376+
end
359377
end
360378

361379
fig.tight_layout()
362380

363-
364-
# # Force Components
365-
# for (idx, component) in enumerate(["x", "y", "z"])
366-
# plot!(res[6+idx],
367-
# title="Force in $component direction",
368-
# xlabel="Spanwise Position y/b",
369-
# ylabel=L"F_%$component"
370-
# )
371-
# for (y_coords, results, label) in zip(y_coordinates_list, results_list, label_list)
372-
# # Extract force components for the current direction (idx)
373-
# forces = results["F_distribution"][idx, :]
374-
375-
# # Verify dimensions match
376-
# if length(y_coords) != length(forces)
377-
# @warn "Dimension mismatch in force plotting" length(y_coords) length(forces) component
378-
# continue # Skip this component instead of throwing error
379-
# end
380-
381-
# plot!(res[6+idx], y_coords, forces,
382-
# label="$label ΣF_$component: $(round(results["F$component"], digits=2))N")
383-
# end
384-
# end
385-
386-
# # Save and show plot
387-
# if is_save
388-
# save_plot(res, save_path, title, data_type=data_type)
389-
# end
381+
# # Save and show plot
382+
# if is_save
383+
# save_plot(fig, save_path, title, data_type=data_type)
384+
# end
390385

391-
# if is_show
392-
# show_plot(res)
393-
# end
386+
if is_show
387+
show_plot(fig)
388+
end
394389

395-
# return res
390+
return fig
396391
end
397392

398393
# """

0 commit comments

Comments
 (0)