Skip to content

Commit f6fd489

Browse files
authored
Visualization: Don't mess with rcParams (#90)
Setting matplotlib rcParams makes it impossible to use custom styles, and therefore, should best be avoided.
1 parent 22a9a0c commit f6fd489

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

petab/visualize/plotter.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -346,23 +346,13 @@ def generate_figure(
346346
In case subplots are saved to file.
347347
"""
348348

349-
# Set Options for plots
350-
# possible options: see: plt.rcParams.keys()
351-
352-
# TODO: or some other style
353-
plt.style.use('tableau-colorblind10')
354-
355-
plt.rcParams['font.size'] = 12
356-
plt.rcParams['axes.titlesize'] = 12
357-
plt.rcParams['figure.figsize'] = self.figure.size
358-
plt.rcParams['errorbar.capsize'] = 2
359-
360349
if subplot_dir is None:
361350
# compute, how many rows and columns we need for the subplots
362351
num_row = int(np.round(np.sqrt(self.figure.num_subplots)))
363352
num_col = int(np.ceil(self.figure.num_subplots / num_row))
364353

365-
fig, axes = plt.subplots(num_row, num_col, squeeze=False)
354+
fig, axes = plt.subplots(num_row, num_col, squeeze=False,
355+
figsize=self.figure.size)
366356
fig.set_tight_layout(True)
367357

368358
for ax in axes.flat[self.figure.num_subplots:]:
@@ -373,7 +363,7 @@ def generate_figure(
373363

374364
for idx, subplot in enumerate(self.figure.subplots):
375365
if subplot_dir is not None:
376-
fig, ax = plt.subplots()
366+
fig, ax = plt.subplots(figsize=self.figure.size)
377367
fig.set_tight_layout(True)
378368
else:
379369
ax = axes[subplot.plotId]

0 commit comments

Comments
 (0)