Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
DavidT3 opened this issue Feb 3, 2025 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@DavidT3
Copy link
Owner

DavidT3 commented Feb 3, 2025

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 DavidT3 added the bug Something isn't working label Feb 3, 2025
@DavidT3 DavidT3 self-assigned this Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant