From 3d59f66b60f1c59f50b03908de4e4d8ac3fb4c0f Mon Sep 17 00:00:00 2001 From: Iara Ota <15733043+iaraota@users.noreply.github.com> Date: Mon, 5 Feb 2024 13:04:09 -0600 Subject: [PATCH] Add default `rcParams` (#386) * add default rcParams * fix rcParams test * fix figsize assertion --------- Co-authored-by: Iara Ota --- gwsumm/plot/core.py | 36 +++++++++++++++++++++++++++++++++++- gwsumm/tests/test_plot.py | 2 +- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/gwsumm/plot/core.py b/gwsumm/plot/core.py index 044b41b2..6f0a6663 100644 --- a/gwsumm/plot/core.py +++ b/gwsumm/plot/core.py @@ -212,7 +212,41 @@ class DataPlot(SummaryPlot): #: plot() call style _single_call = False #: dict of default plotting kwargs - defaults = {} + defaults = { + 'animation.convert_args': ['-layers', 'OptimizePlus'], + 'axes.axisbelow': False, + 'axes.edgecolor': 'gray', + 'axes.formatter.limits': [-3, 4], + 'axes.formatter.use_mathtext': True, + 'axes.grid': True, + 'axes.labelpad': 5.0, + 'axes.labelsize': 18.0, + 'axes.titlesize': 22.0, + 'contour.algorithm': 'mpl2014', + 'figure.figsize': [12.0, 6.0], + 'figure.labelsize': 'large', + 'figure.labelweight': 'normal', + 'font.sans-serif': ['Roboto'], + 'grid.alpha': 0.5, + 'grid.linewidth': 0.5, + 'legend.edgecolor': 'inherit', + 'legend.fancybox': False, + 'legend.fontsize': 10.0, + 'legend.handlelength': 1.0, + 'legend.numpoints': 2, + 'mathtext.bf': 'Roboto', + 'mathtext.cal': 'Calligraffiti', + 'mathtext.fontset': 'custom', + 'mathtext.it': 'Roboto:italic', + 'mathtext.rm': 'Roboto', + 'mathtext.sf': 'Roboto', + 'mathtext.tt': 'Roboto Slab', + 'savefig.transparent': True, + 'svg.fonttype': 'none', + 'text.parse_math': True, + 'xtick.labelsize': 14.0, + 'ytick.labelsize': 14.0, + } #: list of parameters parsed for `plot()` calls DRAW_PARAMS = list(putils.ARTIST_PARAMS) diff --git a/gwsumm/tests/test_plot.py b/gwsumm/tests/test_plot.py index 7c0cda52..e59a469d 100644 --- a/gwsumm/tests/test_plot.py +++ b/gwsumm/tests/test_plot.py @@ -250,7 +250,7 @@ def test_from_ini(self): assert plot.channels == [get_channel('X1:TEST'), get_channel('Y1:TEST')] assert plot.pargs == {'marker': 'o'} - assert plot.rcParams == {'figure.figsize': (2, 1)} + assert plot.rcParams['figure.figsize'] == (2, 1) cp.set('plot', 'type', 'blah') with pytest.warns(UserWarning):