From e10c20c101c8755fed7baa9ffb133595057d1cfd Mon Sep 17 00:00:00 2001 From: "William F. Broderick" Date: Fri, 8 Nov 2024 12:38:23 -0500 Subject: [PATCH] adds gridlines to critical sclaing pointplot --- Snakefile | 5 +++++ foveated_metamers/plotting.py | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Snakefile b/Snakefile index 3c93382..8dd0ef1 100644 --- a/Snakefile +++ b/Snakefile @@ -4518,6 +4518,11 @@ rule critical_scaling_pointplot: with open(log[0], 'w', buffering=1) as log_file: with contextlib.redirect_stdout(log_file), contextlib.redirect_stderr(log_file): style, fig_width = fov.style.plotting_style(wildcards.context, figsize='half') + # some modifications to the style, because we want the gridlines + mpl.rcParams['axes.grid'] = True + mpl.rcParams['axes.grid.axis'] = 'y' + mpl.rcParams['axes.grid.which'] = 'both' + mpl.rcParams['axes.axisbelow'] = True crit_scaling = [] for f in input: tmp = az.from_netcdf(f) diff --git a/foveated_metamers/plotting.py b/foveated_metamers/plotting.py index 6710f38..8fcba04 100644 --- a/foveated_metamers/plotting.py +++ b/foveated_metamers/plotting.py @@ -2165,8 +2165,8 @@ def vertical_pointplot(data, x, y, norm_y=False, **kwargs): data = data.groupby(['model', 'trial_type']).critical_scaling.mean().reset_index() if norm_y: data[y] = data[y] / data[y].min() - # want the line to be under the points, so set zorder=0 - ax.plot(data[x].values, data[y].values, linewidth=lw, zorder=0, **kwargs) + # want the line to be under the points but above the gridlines + ax.plot(data[x].values, data[y].values, linewidth=lw, zorder=1, **kwargs) if kwargs['label'] == 'Luminance\n(this study)': marker = {'metamer_vs_reference': 'o', 'metamer_vs_metamer': r'$\bigwedge$'} else: