@@ -6,7 +6,7 @@ Set the default style for plots using LaTeX.
66``
77# Arguments:
88- `titel_size`: size of the plot title in points (default: 16)
9- - `use_tex `: if a separately installed LaTeX version shall be used
9+ - `ùse_tex `: if the external `pdflatex` command shall be used
1010"""
1111function set_plot_style (titel_size= 16 ; use_tex= false )
1212 rcParams = plt. PyDict (plt. matplotlib." rcParams" )
@@ -148,7 +148,8 @@ function set_axes_equal!(ax; zoom=1.8)
148148end
149149
150150"""
151- create_geometry_plot(body_aero::BodyAerodynamics, title, view_elevation, view_azimuth; zoom=1.8)
151+ create_geometry_plot(body_aero::BodyAerodynamics, title, view_elevation, view_azimuth;
152+ zoom=1.8, use_tex=false)
152153
153154Create a 3D plot of wing geometry including panels and filaments.
154155
@@ -162,8 +163,8 @@ Create a 3D plot of wing geometry including panels and filaments.
162163- zoom: zoom factor (default: 1.8)
163164"""
164165function create_geometry_plot (body_aero:: BodyAerodynamics , title, view_elevation, view_azimuth;
165- zoom= 1.8 )
166- set_plot_style (28 )
166+ zoom= 1.8 , use_tex = false )
167+ set_plot_style (28 ; use_tex )
167168
168169 panels = body_aero. panels
169170 va = isa (body_aero. va, Tuple) ? body_aero. va[1 ] : body_aero. va
249250 plot_geometry(body_aero::BodyAerodynamics, title;
250251 data_type=".pdf", save_path=nothing,
251252 is_save=false, is_show=false,
252- view_elevation=15, view_azimuth=-120)
253+ view_elevation=15, view_azimuth=-120, use_tex=false )
253254
254255Plot wing geometry from different viewpoints and optionally save/show plots.
255256
@@ -264,6 +265,7 @@ Plot wing geometry from different viewpoints and optionally save/show plots.
264265- `is_show`: boolean value, indicates if the graphic shall be displayed (default: `false`)
265266- `view_elevation`: initial view elevation angle (default: 15) [°]
266267- `view_azimuth`: initial view azimuth angle (default: -120) [°]
268+ - `use_tex`: if the external `pdflatex` command shall be used (default: false)
267269
268270"""
269271function VortexStepMethod. plot_geometry (body_aero:: BodyAerodynamics , title;
@@ -272,41 +274,42 @@ function VortexStepMethod.plot_geometry(body_aero::BodyAerodynamics, title;
272274 is_save= false ,
273275 is_show= false ,
274276 view_elevation= 15 ,
275- view_azimuth= - 120 )
277+ view_azimuth= - 120 ,
278+ use_tex= false )
276279
277280 if is_save
278281 plt. ioff ()
279282 # Angled view
280- fig = create_geometry_plot (body_aero, " $(title) _angled_view" , 15 , - 120 )
283+ fig = create_geometry_plot (body_aero, " $(title) _angled_view" , 15 , - 120 ; use_tex )
281284 save_plot (fig, save_path, " $(title) _angled_view" , data_type= data_type)
282285
283286 # Top view
284- fig = create_geometry_plot (body_aero, " $(title) _top_view" , 90 , 0 )
287+ fig = create_geometry_plot (body_aero, " $(title) _top_view" , 90 , 0 ; use_tex )
285288 save_plot (fig, save_path, " $(title) _top_view" , data_type= data_type)
286289
287290 # Front view
288- fig = create_geometry_plot (body_aero, " $(title) _front_view" , 0 , 0 )
291+ fig = create_geometry_plot (body_aero, " $(title) _front_view" , 0 , 0 ; use_tex )
289292 save_plot (fig, save_path, " $(title) _front_view" , data_type= data_type)
290293
291294 # Side view
292- fig = create_geometry_plot (body_aero, " $(title) _side_view" , 0 , - 90 )
295+ fig = create_geometry_plot (body_aero, " $(title) _side_view" , 0 , - 90 ; use_tex )
293296 save_plot (fig, save_path, " $(title) _side_view" , data_type= data_type)
294297 end
295298
296299 if is_show
297300 plt. ion ()
298- fig = create_geometry_plot (body_aero, title, view_elevation, view_azimuth)
301+ fig = create_geometry_plot (body_aero, title, view_elevation, view_azimuth; use_tex )
299302 plt. display (fig)
300303 else
301- fig = create_geometry_plot (body_aero, title, view_elevation, view_azimuth)
304+ fig = create_geometry_plot (body_aero, title, view_elevation, view_azimuth; use_tex )
302305 end
303306 fig
304307end
305308
306309"""
307310 plot_distribution(y_coordinates_list, results_list, label_list;
308311 title="spanwise_distribution", data_type=".pdf",
309- save_path=nothing, is_save=false, is_show=true)
312+ save_path=nothing, is_save=false, is_show=true, use_tex=false )
310313
311314Plot spanwise distributions of aerodynamic properties.
312315
@@ -321,20 +324,22 @@ Plot spanwise distributions of aerodynamic properties.
321324- `save_path`: Path to save plots (default: nothing)
322325- `is_save`: Whether to save plots (default: false)
323326- `is_show`: Whether to display plots (default: true)
327+ - `use_tex`: if the external `pdflatex` command shall be used
324328"""
325329function VortexStepMethod. plot_distribution (y_coordinates_list, results_list, label_list;
326330 title= " spanwise_distribution" ,
327331 data_type= " .pdf" ,
328332 save_path= nothing ,
329333 is_save= false ,
330- is_show= true )
334+ is_show= true ,
335+ use_tex= false )
331336
332337 length (results_list) == length (label_list) || throw (ArgumentError (
333338 " Number of results ($(length (results_list)) ) must match number of labels ($(length (label_list)) )"
334339 ))
335340
336341 # Set the plot style
337- set_plot_style ()
342+ set_plot_style (; use_tex )
338343
339344 # Initializing plot
340345 fig, axs = plt. subplots (3 , 3 , figsize= (16 , 10 ))
474479"""
475480 generate_polar_data(solver, body_aero::BodyAerodynamics, angle_range;
476481 angle_type="angle_of_attack", angle_of_attack=0.0,
477- side_slip=0.0, v_a=10.0)
482+ side_slip=0.0, v_a=10.0, use_latex=false )
478483
479484Generate polar data for aerodynamic analysis over a range of angles.
480485
@@ -499,7 +504,8 @@ function generate_polar_data(
499504 angle_type= " angle_of_attack" ,
500505 angle_of_attack= 0.0 ,
501506 side_slip= 0.0 ,
502- v_a= 10.0
507+ v_a= 10.0 ,
508+ use_latex= false
503509)
504510 n_panels = length (body_aero. panels)
505511 n_angles = length (angle_range)
@@ -517,8 +523,6 @@ function generate_polar_data(
517523 # Previous gamma for initialization
518524 gamma = nothing
519525
520- set_plot_style ()
521-
522526 for (i, angle_i) in enumerate (angle_range)
523527 # Set angle based on type
524528 if angle_type == " angle_of_attack"
578582 angle_range=range(0, 20, 2), angle_type="angle_of_attack",
579583 angle_of_attack=0.0, side_slip=0.0, v_a=10.0,
580584 title="polar", data_type=".pdf", save_path=nothing,
581- is_save=true, is_show=true)
585+ is_save=true, is_show=true, use_tex=false )
582586
583587Plot polar data comparing different solvers and configurations.
584588
@@ -599,6 +603,7 @@ Plot polar data comparing different solvers and configurations.
599603- `save_path`: Path to save plots (default: nothing)
600604- `is_save`: Whether to save plots (default: true)
601605- `is_show`: Whether to display plots (default: true)
606+ - `use_tex`: if the external `pdflatex` command shall be used (default: false)
602607"""
603608function VortexStepMethod. plot_polars (
604609 solver_list,
@@ -614,7 +619,8 @@ function VortexStepMethod.plot_polars(
614619 data_type= " .pdf" ,
615620 save_path= nothing ,
616621 is_save= true ,
617- is_show= true
622+ is_show= true ,
623+ use_tex= false
618624)
619625 # Validate inputs
620626 total_cases = length (body_aero_list) + length (literature_path_list)
@@ -623,6 +629,7 @@ function VortexStepMethod.plot_polars(
623629 " cases ($total_cases ), and labels ($(length (label_list)) )" ))
624630 end
625631 main_title = replace (title, " " => " _" )
632+ set_plot_style (; use_tex)
626633
627634 # Generate polar data
628635 polar_data_list = []
0 commit comments