Skip to content

Commit 8e54dfd

Browse files
committed
happy with the legend now
1 parent 56fcab8 commit 8e54dfd

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

examples/rectangular_wing.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ println("Projected area = $(round(results_vsm["projected_area"], digits=4)) m²"
5555
# Step 6: Plot geometry
5656
plot_geometry(
5757
wa,
58-
"rectangular_wing_geometry";
58+
"Rectangular_wing_geometry";
5959
data_type=".pdf",
6060
save_path=".",
6161
is_save=false,

src/color_palette.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ function set_plot_style()
7676
rcParams["text.usetex"] = true
7777
rcParams["font.family"] = "serif"
7878
rcParams["font.serif"] = ["Computer Modern Roman"]
79-
rcParams["axes.titlesize"] = 14
79+
rcParams["axes.titlesize"] = 28
80+
# rcParams["axes.ymargin"] = 0.1
8081
rcParams["axes.labelsize"] = 12
8182
rcParams["axes.linewidth"] = 1
8283
rcParams["lines.linewidth"] = 1

src/plotting.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,10 @@ end
8181
8282
Set 3D plot axes to equal scale.
8383
"""
84-
function set_axes_equal!(ax)
85-
x_lims = ax.get_xlim3d()
86-
y_lims = ax.get_ylim3d()
87-
z_lims = ax.get_zlim3d()
84+
function set_axes_equal!(ax; zoom=1.8)
85+
x_lims = ax.get_xlim3d() ./ zoom
86+
y_lims = ax.get_ylim3d() ./ zoom
87+
z_lims = ax.get_zlim3d() ./ zoom
8888

8989
x_range = abs(x_lims[2] - x_lims[1])
9090
y_range = abs(y_lims[2] - y_lims[1])
@@ -106,7 +106,7 @@ end
106106
107107
Create a 3D plot of wing geometry including panels and filaments.
108108
"""
109-
function create_geometry_plot(wing_aero, title, view_elevation, view_azimuth)
109+
function create_geometry_plot(wing_aero, title, view_elevation, view_azimuth; zoom=1.8)
110110
set_plot_style()
111111

112112
panels = wing_aero.panels
@@ -171,20 +171,20 @@ function create_geometry_plot(wing_aero, title, view_elevation, view_azimuth)
171171
# Add legends for the first occurrence of each label
172172
handles, labels = ax.get_legend_handles_labels()
173173
by_label = Dict(zip(labels, handles))
174-
ax.legend(values(by_label), keys(by_label))
174+
ax.legend(values(by_label), keys(by_label), bbox_to_anchor = (0,0,1.1,1))
175175

176176
# Set labels and make axes equal
177177
ax.set_xlabel("x")
178178
ax.set_ylabel("y")
179179
ax.set_zlabel("z")
180-
set_axes_equal!(ax)
180+
set_axes_equal!(ax; zoom)
181181

182182
# Set the initial view
183183
ax.view_init(elev=view_elevation, azim=view_azimuth)
184184

185185
# Ensure the figure is fully rendered
186186
fig.canvas.draw()
187-
plt.tight_layout()
187+
plt.tight_layout(rect=(0,0,1,0.97))
188188

189189
return fig
190190
end

0 commit comments

Comments
 (0)