Skip to content

Commit 001bd3e

Browse files
committed
Make use of LaTeX optional
1 parent 2b80317 commit 001bd3e

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

src/plotting.jl

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11

22
"""
3-
set_plot_style(titel_size=16)
3+
set_plot_style(titel_size=16; use_tex=false)
44
55
Set the default style for plots using LaTeX.
6-
6+
``
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
910
"""
10-
function set_plot_style(titel_size=16)
11+
function set_plot_style(titel_size=16; use_tex=false)
1112
rcParams = plt.PyDict(plt.matplotlib."rcParams")
12-
rcParams["text.usetex"] = true
13+
rcParams["text.usetex"] = use_tex
1314
rcParams["font.family"] = "serif"
14-
rcParams["font.serif"] = ["Computer Modern Roman"]
15+
if use_tex
16+
rcParams["font.serif"] = ["Computer Modern Roman"]
17+
end
1518
rcParams["axes.titlesize"] = titel_size
1619
rcParams["axes.labelsize"] = 12
1720
rcParams["axes.linewidth"] = 1
@@ -21,7 +24,9 @@ function set_plot_style(titel_size=16)
2124
rcParams["ytick.labelsize"] = 10
2225
rcParams["legend.fontsize"] = 10
2326
rcParams["figure.titlesize"] = 16
24-
rcParams["pgf.texsystem"] = "pdflatex" # Use pdflatex
27+
if use_tex
28+
rcParams["pgf.texsystem"] = "pdflatex" # Use pdflatex
29+
end
2530
rcParams["pgf.rcfonts"] = false
2631
rcParams["figure.figsize"] = (10, 6) # Default figure size
2732
end
@@ -221,8 +226,8 @@ function create_geometry_plot(body_aero::BodyAerodynamics, title, view_elevation
221226

222227
# Add legends for the first occurrence of each label
223228
handles, labels = ax.get_legend_handles_labels()
224-
by_label = Dict(zip(labels, handles))
225-
ax.legend(values(by_label), keys(by_label), bbox_to_anchor=(0, 0, 1.1, 1))
229+
# by_label = Dict(zip(labels, handles))
230+
# ax.legend(values(by_label), keys(by_label), bbox_to_anchor=(0, 0, 1.1, 1))
226231

227232
# Set labels and make axes equal
228233
ax.set_xlabel("x")

0 commit comments

Comments
 (0)