From 9f2199e69aad86c736b323480e912ec5e7721d2b Mon Sep 17 00:00:00 2001 From: rasmusvt Date: Thu, 18 Aug 2022 09:39:14 +0200 Subject: [PATCH] Make colour gradient work as intended for subsets --- nafuma/xanes/plot.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/nafuma/xanes/plot.py b/nafuma/xanes/plot.py index f4389d5..440308c 100644 --- a/nafuma/xanes/plot.py +++ b/nafuma/xanes/plot.py @@ -38,16 +38,19 @@ def plot_xanes(data, options={}): # Update list of cycles to correct indices update_scans_list(data=data, options=options) - colours = generate_colours(scans=data['path'], options=options) - + colours = generate_colours(scans=options['which_scans'], options=options) # Prepare plot, and read and process data fig, ax = btp.prepare_plot(options=options) + + # Add counter to pick out correct colour + counter = 0 for i, path in enumerate(data['path']): if i in options['which_scans']: - data['xanes_data'].plot(x='ZapEnergy', y=path, ax=ax, c=colours[i]) + data['xanes_data'].plot(x='ZapEnergy', y=path, ax=ax, c=colours[counter]) + counter += 1 fig, ax = btp.adjust_plot(fig=fig, ax=ax, options=options)