Improved set_mpl_style and added docstrings
+import porespy as ps
import matplotlib.pyplot as plt
def set_mpl_style(): # pragma: no cover
+ r"""
+ Prettifies matplotlib's output by adjusting fonts, markersize etc.
+ """
+ sfont = 12
+ mfont = 12
+ lfont = 12
- sfont = 14
- mfont = 14
- lfont = 14
-
- image_props = {'interpolation': 'none'}
+ image_props = {'interpolation': 'none',
+ 'cmap': 'cividis'}
line_props = {'linewidth': 2,
- 'markersize': 8}
+ 'markersize': 8,
+ 'markerfacecolor': 'w'}
font_props = {'size': sfont}
axes_props = {'titlesize': lfont,
'labelsize': mfont,
@@ -27,7 +32,8 @@ def set_mpl_style(): # pragma: no cover
'major.width': 2}
legend_props = {'fontsize': mfont,
'frameon': False}
- figure_props = {'titlesize': sfont}
+ figure_props = {'titlesize': sfont,
+ 'autolayout': True}
plt.rc('font', **font_props)
plt.rc('lines', **line_props)
@@ -37,3 +43,7 @@ def set_mpl_style(): # pragma: no cover
plt.rc('legend', **legend_props)
plt.rc('figure', **figure_props)
plt.rc('image', **image_props)
+
+ if ps.settings.notebook:
+ import IPython
+ IPython.display.set_matplotlib_formats('svg')
