XGA icon indicating copy to clipboard operation
XGA copied to clipboard

List index error when using the view method combined scaling relation instances, if they have the same colour set

Open DavidT3 opened this issue 8 months ago • 0 comments

This hasn't been an issue where each scaling relation that is being shown on the same axis has had a distinct colour assigned, because you wouldn't want to plot things with the same colour on the same axis.

But where no model colour has been set for a particular relation, it will default to the same value (or if the user just sets a bunch to have the same colour accidentally), and then you get the following error:

IndexError Traceback (most recent call last) Cell In[15], line 1 ----> 1 AggregateScalingRelation(list(sub_samp_mtot500_tx500.values())).view()

File ~/software/anaconda3/envs/xga_env/lib/python3.12/site-packages/xga/products/relation.py:1509, in AggregateScalingRelation.view(self, x_lims, log_scale, plot_title, figsize, colour_list, grid_on, conf_level, show_data, fontsize, legend_fontsize, x_ticks, x_minor_ticks, y_ticks, y_minor_ticks, save_path, data_colour_list, data_shape_list, custom_x_label, custom_y_label, y_lims, one_to_one) 1504 d_out = ax.errorbar(None, None, xerr=None, yerr=None, fmt=data_shape_list[rel_ind], capsize=2, label='', 1505 color=data_colour_list[rel_ind]) 1506 else: 1507 d_out = ax.errorbar(rel.x_data.value[:, 0], rel.y_data.value[:, 0], xerr=rel.x_data.value[:, 1], 1508 yerr=rel.y_data.value[:, 1], fmt=data_shape_list[rel_ind], capsize=2, -> 1509 color=data_colour_list[rel_ind], alpha=0.7) 1511 m_colour = colour_list[rel_ind] 1513 # Need to randomly sample from the fitted model

IndexError: list index out of range

DavidT3 avatar Feb 03 '25 03:02 DavidT3