From d3f5f4ae62d0a65e211270cb6b9a0ffc18313f7c Mon Sep 17 00:00:00 2001 From: Lee de Mora Date: Wed, 20 Mar 2024 11:53:59 +0000 Subject: [PATCH] Made it possible to set a legend label to None, to prevent doubles --- bgcval2/timeseries/timeseriesPlots.py | 9 ++++++- input_yml/TerraFIRMA_overshoot_recovery.yml | 26 ++++++++++----------- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/bgcval2/timeseries/timeseriesPlots.py b/bgcval2/timeseries/timeseriesPlots.py index e25f4e45..fb6d2ac3 100644 --- a/bgcval2/timeseries/timeseriesPlots.py +++ b/bgcval2/timeseries/timeseriesPlots.py @@ -749,6 +749,8 @@ def multitimeseries( else: print("colours isn't working.") + final_labels = [] + for i, jobID in enumerate(sorted(timesD.keys())): times = timesD[jobID] arr = arrD[jobID] @@ -788,7 +790,12 @@ def multitimeseries( if np.min(arr) < ylims[0]: ylims[0] = np.min(arr) if np.max(arr) > ylims[1]: ylims[1] = np.max(arr) - label = labels.get(jobID, jobID) + # If label is None, we put nothing. + if labels.get(jobID, True) in [None, '', 'None', 'none']: + label = None + else: + label = labels.get(jobID, jobID) + if smoothing.lower() in ['spline', 'all']: tnew = np.linspace(times[0], times[-1], 60) arr_smooth = interpolate.spline(times, arr, tnew) diff --git a/input_yml/TerraFIRMA_overshoot_recovery.yml b/input_yml/TerraFIRMA_overshoot_recovery.yml index ec93407d..87aa0a3d 100644 --- a/input_yml/TerraFIRMA_overshoot_recovery.yml +++ b/input_yml/TerraFIRMA_overshoot_recovery.yml @@ -206,7 +206,7 @@ jobs: # -2 dashdot u-cz944: description: 'Ramp down from cy838 (- 2.0K Stabilisation from u-cx209) (#1)' - label: '2K Rampdown #1' + label: '2K Rampdown' colour: 'goldenrod' thickness: 1.7 linestyle: 'dotted' @@ -216,7 +216,7 @@ jobs: u-da800: description: 'Ramp down from cy838 (- 2.0K Stabilisation from u-cx209) (#1)' - label: '2K Rampdown #1' + label: None #'2K Rampdown #1' colour: 'goldenrod' thickness: 1.7 linestyle: 'dotted' @@ -226,7 +226,7 @@ jobs: u-da697: description: '1.5K Rampdown from u-cx209 (#1)' - label: '1.5K Rampdown #1' + label: '1.5K Rampdown' colour: 'lawngreen' thickness: 1.7 linestyle: 'dotted' @@ -236,7 +236,7 @@ jobs: u-da892: description: '4.K Rampdown (#1)' - label: '4.K Rampdown #1' + label: '4.K Rampdown' colour: 'sienna' thickness: 1.7 linestyle: 'dotted' @@ -245,7 +245,7 @@ jobs: u-db223: description: '3.K Rampdown (#1)' - label: '3.K Rampdown #1' + label: '3.K Rampdown' colour: 'red' thickness: 1.7 linestyle: 'dotted' @@ -256,7 +256,7 @@ jobs: u-dc051: description: 'Rampdown from yr 50 of 1.5 stab #1, -4GtC/yr (#1)' - label: '1.5K Rampdown #1' + label: None #'1.5K Rampdown #1' colour: 'lawngreen' thickness: 1.7 linestyle: 'dashed' @@ -266,7 +266,7 @@ jobs: u-dc052: description: 'Rampdown from yr 200 of 1.5deg, -4GtC/yr (#1)' - label: '1.5K Rampdown #1' + label: None #'1.5K Rampdown #1' colour: 'lawngreen' thickness: 1.7 linestyle: 'dashed' @@ -276,7 +276,7 @@ jobs: u-dc248: description: '1.5K Rampdown -4GtC/yr, (#1)' - label: '1.5K Rampdown #1' + label: None #'1.5K Rampdown #1' colour: 'lawngreen' thickness: 1.7 linestyle: 'dashed' @@ -285,7 +285,7 @@ jobs: u-dc249: description: '3.K Rampdown -4GtC/yr, 200 years, (#1)' - label: '3.K Rampdown #1' + label: None #'3.K Rampdown #1' colour: 'red' thickness: 1.7 linestyle: 'dashed' @@ -294,7 +294,7 @@ jobs: u-dc251: description: '5K Rampdown -8GtC/yr, 50 years, (#1)' - label: '5K Rampdown #1' + label: '5K Rampdown' colour: 'maroon' thickness: 1.7 linestyle: 'dotted' @@ -312,7 +312,7 @@ jobs: u-dc032: description: 'ramp-down from yr 50 of 3.0 stab #1, free ice, -4GtC/yr (#1)' - label: '3K Rampdown #1' + label: None #'3K Rampdown #1' colour: 'red' thickness: 1.7 linestyle: 'dashed' @@ -322,7 +322,7 @@ jobs: u-dc123: description: 'ramp-down from yr 50 of 4.0 stab #1, free ice, -4GtC/yr (#1)' - label: '4K Rampdown #1' + label: None #'4K Rampdown #1' colour: 'sienna' thickness: 1.7 linestyle: 'dashed' @@ -332,7 +332,7 @@ jobs: u-dc130: description: 'ramp-down from yr 50 of 5.0 stab #1, free ice, -4GtC/yr (#1)' - label: '5K Rampdown #1' + label: None #'5K Rampdown #1' colour: 'maroon' thickness: 1.7 linestyle: 'dashed'