Skip to content

Commit

Permalink
Merge pull request #451 from fast-aircraft-design/issue-450_mass-plot…
Browse files Browse the repository at this point in the history
…-limitation

Now allowing more than 5 datasets in mass breakdown bar plot
  • Loading branch information
ScottDelbecq committed Jul 28, 2022
2 parents 710af2d + 6be69ae commit 38ff4a7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
8 changes: 4 additions & 4 deletions src/fastoad/gui/analysis_and_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Defines the analysis and plotting functions for postprocessing
"""
# This file is part of FAST-OAD : A framework for rapid Overall Aircraft Design
# Copyright (C) 2021 ONERA & ISAE-SUPAERO
# Copyright (C) 2022 ONERA & ISAE-SUPAERO
# FAST is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
Expand All @@ -17,15 +17,15 @@
from typing import Dict

import numpy as np
import plotly
import plotly.express as px
import plotly.graph_objects as go
from openmdao.utils.units import convert_units
from plotly.subplots import make_subplots

from fastoad.io import VariableIO
from fastoad.openmdao.variables import VariableList

COLS = plotly.colors.DEFAULT_PLOTLY_COLORS
COLS = px.colors.qualitative.Plotly


# pylint: disable-msg=too-many-locals
Expand Down Expand Up @@ -303,7 +303,7 @@ def mass_breakdown_bar_plot(
)

# Same color for each aircraft configuration
i = len(fig.data)
i = int(len(fig.data) / 2) % 10

weight_labels = ["MTOW", "OWE", "Fuel - Mission", "Payload"]
weight_values = [mtow, owe, fuel_mission, payload]
Expand Down
17 changes: 10 additions & 7 deletions src/fastoad/gui/tests/test_analysis_and_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Tests for analysis and plots functions
"""
# This file is part of FAST-OAD : A framework for rapid Overall Aircraft Design
# Copyright (C) 2021 ONERA & ISAE-SUPAERO
# Copyright (C) 2022 ONERA & ISAE-SUPAERO
# FAST is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
Expand Down Expand Up @@ -44,10 +44,11 @@ def test_wing_geometry_plot():
# The test will fail if an error is raised by the following line
fig = wing_geometry_plot(filename, name="First plot")

# Adding a plot to the previous fig
# Adding plots to the previous fig
# This is a rudimentary test as plot are difficult to verify
# The test will fail if an error is raised by the following line
fig = wing_geometry_plot(filename, name="Second plot", fig=fig)
for i in range(20):
fig = wing_geometry_plot(filename, name=f"Plot {i}", fig=fig)


def test_aircraft_geometry_plot():
Expand All @@ -67,10 +68,11 @@ def test_aircraft_geometry_plot():
# The test will fail if an error is raised by the following line
fig = aircraft_geometry_plot(filename, name="First plot")

# Adding a plot to the previous fig
# Adding plots to the previous fig
# This is a rudimentary test as plot are difficult to verify
# The test will fail if an error is raised by the following line
fig = aircraft_geometry_plot(filename, name="Second plot", fig=fig)
for i in range(20):
fig = aircraft_geometry_plot(filename, name=f"Plot {i}", fig=fig)


def test_mass_breakdown_bar_plot():
Expand All @@ -90,10 +92,11 @@ def test_mass_breakdown_bar_plot():
# The test will fail if an error is raised by the following line
fig = mass_breakdown_bar_plot(filename, name="First plot")

# Adding a plot to the previous fig
# Adding plots to the previous fig
# This is a rudimentary test as plot are difficult to verify
# The test will fail if an error is raised by the following line
_ = mass_breakdown_bar_plot(filename, name="Second plot", fig=fig)
for i in range(20):
_ = mass_breakdown_bar_plot(filename, name=f"Plot {i}", fig=fig)


def test_drag_polar_plot():
Expand Down

0 comments on commit 38ff4a7

Please sign in to comment.