Skip to content

Commit

Permalink
Fix auto set_style()
Browse files Browse the repository at this point in the history
  • Loading branch information
fzhu2e committed Jan 14, 2022
1 parent 53712a9 commit 8fffc09
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
3 changes: 3 additions & 0 deletions pyleoclim/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
from .utils import *
from .core import *

from .utils import plotting
plotting.set_style()

# get the version
from importlib.metadata import version
__version__ = version('pyleoclim')
10 changes: 3 additions & 7 deletions pyleoclim/utils/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
'closefig',
]

from tkinter import Variable
import matplotlib.pyplot as plt
import pathlib
import matplotlib as mpl
Expand Down Expand Up @@ -455,7 +456,7 @@ def savefig(fig, path=None, settings={}, verbose=True):
print(f'Figure saved at: "{str(path)}"')


def set_style(style='journal', font_scale=1.0):
def set_style(style='journal', font_scale=1.5):
''' Modify the visualization style
This function is inspired by [Seaborn](https://github.com/mwaskom/seaborn).
Expand All @@ -477,8 +478,6 @@ def set_style(style='journal', font_scale=1.0):
Default is 1. Corresponding to 12 Font Size.
'''
mpl.rcParams.update(mpl.rcParamsDefault)

font_dict = {
'font.size': 12,
'axes.labelsize': 12,
Expand Down Expand Up @@ -557,11 +556,8 @@ def set_style(style='journal', font_scale=1.0):
'xtick.minor.width': 0,
'ytick.minor.width': 0,
})
elif 'matplotlib' in style or 'default' in style:
mpl.rcParams.update(mpl.rcParamsDefault)
else:
print(f'Style [{style}] not availabel! Setting to `matplotlib` ...')
mpl.rcParams.update(mpl.rcParamsDefault)
raise ValueError(f'Style [{style}] not availabel!')

if '_spines' in style:
style_dict.update({
Expand Down

0 comments on commit 8fffc09

Please sign in to comment.