Skip to content

Commit

Permalink
Made it possible to set a legend label to None, to prevent doubles
Browse files Browse the repository at this point in the history
  • Loading branch information
ledm committed Mar 20, 2024
1 parent 3407f9f commit d3f5f4a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
9 changes: 8 additions & 1 deletion bgcval2/timeseries/timeseriesPlots.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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)
Expand Down
26 changes: 13 additions & 13 deletions input_yml/TerraFIRMA_overshoot_recovery.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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'
Expand All @@ -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'
Expand All @@ -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'
Expand All @@ -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'
Expand All @@ -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'
Expand All @@ -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'
Expand All @@ -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'
Expand All @@ -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'
Expand All @@ -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'
Expand All @@ -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'
Expand All @@ -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'
Expand All @@ -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'
Expand Down

0 comments on commit d3f5f4a

Please sign in to comment.