|
81 | 81 |
|
82 | 82 | Set 3D plot axes to equal scale. |
83 | 83 | """ |
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 |
88 | 88 |
|
89 | 89 | x_range = abs(x_lims[2] - x_lims[1]) |
90 | 90 | y_range = abs(y_lims[2] - y_lims[1]) |
|
106 | 106 |
|
107 | 107 | Create a 3D plot of wing geometry including panels and filaments. |
108 | 108 | """ |
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) |
110 | 110 | set_plot_style() |
111 | 111 |
|
112 | 112 | panels = wing_aero.panels |
@@ -171,20 +171,20 @@ function create_geometry_plot(wing_aero, title, view_elevation, view_azimuth) |
171 | 171 | # Add legends for the first occurrence of each label |
172 | 172 | handles, labels = ax.get_legend_handles_labels() |
173 | 173 | 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)) |
175 | 175 |
|
176 | 176 | # Set labels and make axes equal |
177 | 177 | ax.set_xlabel("x") |
178 | 178 | ax.set_ylabel("y") |
179 | 179 | ax.set_zlabel("z") |
180 | | - set_axes_equal!(ax) |
| 180 | + set_axes_equal!(ax; zoom) |
181 | 181 |
|
182 | 182 | # Set the initial view |
183 | 183 | ax.view_init(elev=view_elevation, azim=view_azimuth) |
184 | 184 |
|
185 | 185 | # Ensure the figure is fully rendered |
186 | 186 | fig.canvas.draw() |
187 | | - plt.tight_layout() |
| 187 | + plt.tight_layout(rect=(0,0,1,0.97)) |
188 | 188 |
|
189 | 189 | return fig |
190 | 190 | end |
|
0 commit comments