fast-aircraft-design / FAST-OAD

FAST-OAD: An open source framework for rapid Overall Aircraft Design
GNU General Public License v3.0
51 stars 25 forks source link

Unable to fit more than 5 configurations in the mass bar plot #450

Closed tbroert closed 2 years ago

tbroert commented 2 years ago

Describe the bug When generating the oad.mass_breakdown_bar_plot() it works perfectly fine when plotting 5 or less configurations, but when plotting more than 5 configurations it yields an 'IndexError'.

To Reproduce To reproduce the issue, have a FAST output file to generate the plot (e.g. OutputFile.xml) fig = oad.mass_breakdown_bar_plot('OutputFile.xml', name='0') for i in range(1, 6): fig_mbd = oad.mass_breakdown_bar_plot('OutputFile.xml', name=str(i), fig=fig) fig.show()

Expected behavior FAST-oad will yield an IndexError: list index out of range

Error message IndexError Traceback (most recent call last) ~\AppData\Local\Temp\ipykernel_11560\371206521.py in <cell line: 3>() 2 fig_mbd = oad.mass_breakdown_barplot(f'OutputFiles/A321{configs[0]}_outputs.xml', name=configs[0]) 3 for config in configs[1:]: ----> 4 fig_mbd = oad.mass_breakdown_barplot(f'OutputFiles/A321{config}_outputs.xml', name=config, fig=fig_mbd) 5 fig_mbd.show()

d:\USER\00_virtualenvironments\fastoadenvironment\lib\site-packages\fastoad\gui\analysis_and_plots.py in mass_breakdown_bar_plot(aircraft_file_path, name, fig, file_formatter) 309 weight_values = [mtow, owe, fuel_mission, payload] 310 fig.add_trace( --> 311 go.Bar(name="", x=weight_labels, y=weight_values, marker_color=COLS[i], showlegend=False), 312 row=1, 313 col=1,

IndexError: list index out of range

Environment