Skip to content

Commit 3ccff73

Browse files
authored
Merge pull request #15345 from rmcdermo/master
Python: set text.usetex=False to reduce plot file size
2 parents 7855c52 + 611d42d commit 3ccff73

File tree

2 files changed

+24
-7
lines changed

2 files changed

+24
-7
lines changed

Utilities/Python/fdsplotlib.py

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -461,12 +461,29 @@ def plot_to_fig(x_data,y_data,**kwargs):
461461
# print ("%s == %s" %(key, value))
462462

463463
plot_style = get_plot_style("fds")
464-
plt.rcParams["font.family"] = plot_style["Font_Name"]
465-
plt.rcParams["font.size"] = plot_style["Label_Font_Size"]
466-
# print(plot_style)
467464

468-
plt.rcParams['text.usetex'] = True # supports latex math (set per plot below)
469-
plt.rcParams["pdf.use14corefonts"] = True # forces matplotlib to write native pdf fonts rather than embed
465+
import matplotlib.pyplot as plt
466+
467+
plt.rcParams.update({
468+
"pdf.use14corefonts": True,
469+
"text.usetex": False,
470+
471+
# Text and math in Times New Roman
472+
"font.family": "serif",
473+
"font.serif": ["Times", "Times New Roman"],
474+
475+
"mathtext.fontset": "custom",
476+
"mathtext.rm": "Times",
477+
"mathtext.it": "Times New Roman:italic",
478+
"mathtext.bf": "Times:bold",
479+
"mathtext.cal": "Times New Roman:italic",
480+
"mathtext.tt": "Courier New",
481+
"mathtext.default": "it",
482+
483+
"axes.unicode_minus": False,
484+
"pdf.compression": 9,
485+
})
486+
470487
import logging
471488
# Suppress just the 'findfont' warnings from matplotlib's font manager
472489
logging.getLogger('matplotlib.font_manager').setLevel(logging.ERROR)

Utilities/Python/scripts/jet_decay.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@
7474
legend_location='outside',
7575
legend_expand=1.25, #optional (default 1.25 for legend_location=='outside')
7676
legend_fontsize=8,
77-
x_label='$x/h$',
78-
y_label=r'$u_{{\rm \scriptsize max}}/u_0$')
77+
x_label=r'$x/h$',
78+
y_label=r'$u_{\rm max}/u_0$')
7979

8080
fdsplotlib.plot_to_fig(x_data=x/h, y_data=u_1/u_0, figure_handle=fig, marker_style='k--', data_label='analytical, $m=0.12$')
8181
fdsplotlib.plot_to_fig(x_data=x/h, y_data=u_2/u_0, figure_handle=fig, marker_style='k-' , data_label='analytical, $m=0.20$')

0 commit comments

Comments
 (0)