From 6638b0470dc7e1e094fd7f748aebf3c826d4706e Mon Sep 17 00:00:00 2001 From: "William F. Broderick" Date: Wed, 9 Oct 2024 17:22:35 -0400 Subject: [PATCH] update spacing for metamer comparison init --- foveated_metamers/compose_figures.py | 17 +++++++++++------ foveated_metamers/style.py | 2 +- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/foveated_metamers/compose_figures.py b/foveated_metamers/compose_figures.py index 35b4462..85ee7ae 100644 --- a/foveated_metamers/compose_figures.py +++ b/foveated_metamers/compose_figures.py @@ -409,10 +409,15 @@ def performance_comparison_natural(performance_fig, metamer_fig, subject_n=1, """ if with_initialization: text_params, figure_width = style.plotting_style(context, 'svgutils', 'extra-wide') + figure_width = _convert_to_pix(figure_width) + figure_height = figure_width+10 else: text_params, figure_width = style.plotting_style(context, 'svgutils', 'full') - figure_width = _convert_to_pix(figure_width) - figure_height = 1.3*figure_width+30 + figure_width = _convert_to_pix(figure_width) + figure_height = 1.3*figure_width+30 + # originally figured out how much to shift the text for panel B using the + # figure_width without initialization, so hopefully this works more generally + b_shift_val = (figure_height - 30) / 1.3 if subject_n is not None: subject_n = f'n={subject_n}' else: @@ -429,10 +434,10 @@ def performance_comparison_natural(performance_fig, metamer_fig, subject_n=1, compose.Text('2', 305, 115, size=n_font_size, **text_params), compose.Text('3', 305, 200, size=n_font_size, **text_params), compose.Text(subject_n, 80, 50, size=n_font_size, **text_params), - compose.Text('B', 0, figure_width/2, size=label_font_size, **text_params), - compose.Text('1', 0, figure_width/2+80, size=n_font_size, **text_params), - compose.Text('2', 0, figure_width/2+80+170, size=n_font_size, **text_params), - compose.Text('3', 0, figure_width/2+80+2*170, size=n_font_size, **text_params), + compose.Text('B', 0, b_shift_val/2, size=label_font_size, **text_params), + compose.Text('1', 0, b_shift_val/2+80, size=n_font_size, **text_params), + compose.Text('2', 0, b_shift_val/2+80+170, size=n_font_size, **text_params), + compose.Text('3', 0, b_shift_val/2+80+2*170, size=n_font_size, **text_params), ) diff --git a/foveated_metamers/style.py b/foveated_metamers/style.py index 9fbafa3..3bfca4b 100644 --- a/foveated_metamers/style.py +++ b/foveated_metamers/style.py @@ -115,7 +115,7 @@ def plotting_style(context='paper', for_package='matplotlib', figsize='full'): if context == 'paper': params = {'font': 'Helvetica', 'size': '18pt'} if figsize == 'extra-wide': - figure_width = '9in' + figure_width = '8.7in' if figsize == 'full': figure_width = '6.5in' elif figsize == 'half':