From e680a6c16da00b2cee1d11066be6ec491dff987e Mon Sep 17 00:00:00 2001 From: Xylar Asay-Davis Date: Sun, 3 Nov 2024 23:13:37 -0600 Subject: [PATCH] Allow for longer titles The region name is getting completely cut off in some cases. --- mpas_analysis/default.cfg | 3 +++ mpas_analysis/ocean/time_series_ocean_regions.py | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/mpas_analysis/default.cfg b/mpas_analysis/default.cfg index ffa0f3037..0f58b60e1 100755 --- a/mpas_analysis/default.cfg +++ b/mpas_analysis/default.cfg @@ -1713,6 +1713,9 @@ availableVariables = [ 'units': 'm', 'mpas': ['timeMonthly_avg_dThreshMLD']}] +# allow for longer plot titles +maxTitleLength = 55 + [timeSeriesArcticOceanRegions] ## options related to plotting time series of Arctic Ocean regions diff --git a/mpas_analysis/ocean/time_series_ocean_regions.py b/mpas_analysis/ocean/time_series_ocean_regions.py index c97b0d5df..7004c5648 100644 --- a/mpas_analysis/ocean/time_series_ocean_regions.py +++ b/mpas_analysis/ocean/time_series_ocean_regions.py @@ -1178,6 +1178,9 @@ def run_task(self): timeSeriesName, f'{timeSeriesName}_{startYear:04d}-{endYear:04d}.nc') + maxTitleLength = config.getint('timeSeriesOceanRegions', + 'maxTitleLength') + sectionName = self.sectionName anomalyVars = config.getexpression(sectionName, 'anomalies') @@ -1334,7 +1337,8 @@ def run_task(self): ylabel=yLabel, movingAveragePoints=movingAveragePoints, lineColors=lineColors, lineWidths=lineWidths, legendText=legendText, titleFontSize=titleFontSize, - defaultFontSize=defaultFontSize) + defaultFontSize=defaultFontSize, + maxTitleLength=maxTitleLength) # do this before the inset because otherwise it moves the inset # and cartopy doesn't play too well with tight_layout anyway @@ -1344,7 +1348,7 @@ def run_task(self): savefig(outFileName, config, tight=False) - caption = f'Regional mean of {title}' + caption = f'Regional {title}' write_image_xml( config=config,