Skip to content

Commit

Permalink
Save figs fix (#39)
Browse files Browse the repository at this point in the history
* Add helper function for saving figure in multiple formats

* Fix behaviour of `save_figs` when single format string passed

* Make check simpler

* flake8 fix
  • Loading branch information
A-CGray authored Feb 14, 2024
1 parent 2c7bc26 commit 7892f4c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 31 deletions.
58 changes: 29 additions & 29 deletions niceplots/styles/doumont-light.mplstyle
Original file line number Diff line number Diff line change
@@ -1,50 +1,50 @@
# Figure settings
savefig.dpi : 600
figure.constrained_layout.use : True
savefig.dpi: 600
figure.constrained_layout.use: True


# Axes settings
axes.spines.top : False
axes.spines.right : False
axes.labelpad : 8.0
axes.xmargin : 0
axes.ymargin : 0
axes.spines.top: False
axes.spines.right: False
axes.labelpad: 8.0
axes.xmargin: 0
axes.ymargin: 0


# Font settings
font.family : sans-serif
font.sans-serif : CMU Bright
axes.unicode_minus : False
font.size : 18
font.family: sans-serif
font.sans-serif: CMU Bright
axes.unicode_minus: False
font.size: 18

axes.labelweight : bold
axes.labelweight: bold

xtick.labelsize : small
ytick.labelsize : small
xtick.labelsize: small
ytick.labelsize: small

text.latex.preamble : r"\usepackage{cmbright}"
text.latex.preamble: r"\usepackage{cmbright}"
mathtext.default: regular
pgf.rcfonts : True
pgf.rcfonts: True


# Legend settings
legend.columnspacing : 0.2
legend.frameon : False
legend.columnspacing: 1.0
legend.frameon: False


# Line settings
lines.linewidth : 2.0
lines.markeredgewidth : 1.0
lines.linewidth: 2.0
lines.markeredgewidth: 1.0

# Color settings
axes.prop_cycle : cycler('color', ['e29400ff', '1E90FF', 'E21A1A', '00a650ff', '800000ff', 'ff8f00', '800080ff', '00A6D6', '000000ff'])
axes.prop_cycle: cycler('color', ['e29400ff', '1E90FF', 'E21A1A', '00a650ff', '800000ff', 'ff8f00', '800080ff', '00A6D6', '000000ff'])

# Use this parameter, which (hopefully) nobody will ever use, to store text the names of the colors in the color cycle
keymap.help : Yellow, Blue, Red, Green, Maroon, Orange, Purple, Cyan, Black

lines.markeredgecolor : w
axes.edgecolor : 5a5758ff
text.color : 5a5758ff
axes.labelcolor : 5a5758ff
xtick.color : 5a5758ff
ytick.color : 5a5758ff
keymap.help: Yellow, Blue, Red, Green, Maroon, Orange, Purple, Cyan, Black

lines.markeredgecolor: w
axes.edgecolor: 5a5758ff
text.color: 5a5758ff
axes.labelcolor: 5a5758ff
xtick.color: 5a5758ff
ytick.color: 5a5758ff
3 changes: 1 addition & 2 deletions niceplots/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import warnings
import os
import copy
from collections.abc import Iterable
from collections import OrderedDict

# ==============================================================================
Expand Down Expand Up @@ -1036,7 +1035,7 @@ def save_figs(fig, name, formats, format_kwargs=None, **kwargs):
fileName = os.path.splitext(name)[0]

# --- Convert the file format to a list if only one given ---
if not isinstance(formats, Iterable):
if isinstance(formats, str):
formats = [formats]

# --- Save the figures ---
Expand Down

0 comments on commit 7892f4c

Please sign in to comment.