Skip to content

Commit a291a8a

Browse files
DOC: flight comparison improvements (#755)
* DOC: Improve flight examples documentation Update flight simulation documentation with improved markdown headers and replace matplotlib with Plotly for enhanced visualizations * DEV: update changelog * DOC: Fix title in camoes simul * DOC: Update docs/requirements.txt to include new dependencies --------- Co-authored-by: LUCKIN13 <[email protected]>
1 parent 6c93aea commit a291a8a

File tree

6 files changed

+51
-27
lines changed

6 files changed

+51
-27
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Attention: The newest changes should be on top -->
4141

4242
### Changed
4343

44-
-
44+
- DOC: flight comparison improvements [#755](https://github.com/RocketPy-Team/RocketPy/pull/755)
4545

4646
### Fixed
4747

docs/examples/camoes_flight_sim.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@
333333
"cell_type": "markdown",
334334
"metadata": {},
335335
"source": [
336-
"# Air Brakes - Active Control Systems"
336+
"## Air Brakes - Active Control Systems"
337337
]
338338
},
339339
{

docs/examples/defiance_flight_sim.ipynb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"cell_type": "markdown",
1717
"metadata": {},
1818
"source": [
19-
"# Importing necessary modules"
19+
"## Importing necessary modules"
2020
]
2121
},
2222
{
@@ -35,7 +35,7 @@
3535
"cell_type": "markdown",
3636
"metadata": {},
3737
"source": [
38-
"# Creating the simulation Environment"
38+
"## Creating the simulation Environment"
3939
]
4040
},
4141
{
@@ -118,7 +118,7 @@
118118
"cell_type": "markdown",
119119
"metadata": {},
120120
"source": [
121-
"# Building the Hybrid Motor"
121+
"## Building the Hybrid Motor"
122122
]
123123
},
124124
{
@@ -179,7 +179,7 @@
179179
"cell_type": "markdown",
180180
"metadata": {},
181181
"source": [
182-
"# Building the Rocket and adding Aerosurfaces"
182+
"## Building the Rocket and adding Aero surfaces"
183183
]
184184
},
185185
{
@@ -231,7 +231,7 @@
231231
"cell_type": "markdown",
232232
"metadata": {},
233233
"source": [
234-
"# Flight Simulation"
234+
"## Flight Simulation"
235235
]
236236
},
237237
{

docs/examples/index.rst

Lines changed: 31 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ apogee of some rockets.
1111
.. jupyter-execute::
1212
:hide-code:
1313

14-
import matplotlib.pyplot as plt
14+
import plotly.graph_objects as go
1515

1616
results = {
1717
# "Name (Year)": (simulated, measured) m
@@ -39,28 +39,40 @@ apogee of some rockets.
3939
labels = list(results.keys())
4040

4141
# Create the plot
42-
fig, ax = plt.subplots(figsize=(9, 9))
43-
ax.scatter(simulated, measured)
44-
ax.grid(True, alpha=0.3)
42+
fig = go.Figure()
4543

4644
# Add the x = y line
47-
ax.plot([0, max_apogee], [0, max_apogee], linestyle='--', color='black', alpha=0.6)
48-
49-
# Add text labels
50-
for i, label in enumerate(labels):
51-
ax.text(simulated[i], measured[i], label, ha='center', va='bottom', fontsize=8)
45+
fig.add_trace(go.Scatter(
46+
x=[0, max_apogee],
47+
y=[0, max_apogee],
48+
mode='lines',
49+
line=dict(dash='dash', color='black'),
50+
showlegend=False
51+
))
52+
53+
# Add scatter plot
54+
fig.add_trace(go.Scatter(
55+
x=simulated,
56+
y=measured,
57+
mode='markers',
58+
text=labels,
59+
textposition='top center',
60+
marker=dict(size=10),
61+
showlegend=False
62+
))
5263

5364
# Set titles and labels
54-
ax.set_title("Simulated x Measured Apogee")
55-
ax.set_xlabel("Simulated Apogee (m)")
56-
ax.set_ylabel("Measured Apogee (m)")
57-
58-
# Set aspect ratio to 1:1
59-
ax.set_aspect('equal', adjustable='box')
60-
ax.set_xlim(0, max_apogee)
61-
ax.set_ylim(0, max_apogee)
62-
63-
plt.show()
65+
fig.update_layout(
66+
title="Simulated x Measured Apogee",
67+
xaxis_title="Simulated Apogee (m)",
68+
yaxis_title="Measured Apogee (m)",
69+
xaxis=dict(range=[0, max_apogee]),
70+
yaxis=dict(range=[0, max_apogee]),
71+
width=650,
72+
height=650
73+
)
74+
75+
fig.show()
6476

6577
In the next sections you will find the simulations of the rockets listed above.
6678

docs/requirements.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ pandas==2.2.2
77
lxml_html_clean==0.1.1
88
sphinx-copybutton==0.5.2
99
sphinx-tabs==3.4.7
10+
plotly>=5

docs/requirements.txt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ docutils==0.20.1
4646
# sphinx-tabs
4747
entrypoints==0.4
4848
# via nbconvert
49+
exceptiongroup==1.2.2
50+
# via ipython
4951
executing==2.0.1
5052
# via stack-data
5153
fastjsonschema==2.19.1
@@ -131,6 +133,7 @@ packaging==24.0
131133
# via
132134
# ipykernel
133135
# nbconvert
136+
# plotly
134137
# pydata-sphinx-theme
135138
# sphinx
136139
pandas==2.2.2
@@ -143,6 +146,8 @@ pexpect==4.9.0
143146
# via ipython
144147
platformdirs==4.2.2
145148
# via jupyter-core
149+
plotly==5.24.1
150+
# via -r requirements.in
146151
prompt-toolkit==3.0.43
147152
# via ipython
148153
psutil==5.9.8
@@ -218,8 +223,12 @@ sphinxcontrib-serializinghtml==1.1.10
218223
# via sphinx
219224
stack-data==0.6.3
220225
# via ipython
226+
tenacity==9.0.0
227+
# via plotly
221228
tinycss2==1.3.0
222229
# via nbconvert
230+
tomli==2.2.1
231+
# via sphinx
223232
tornado==6.4
224233
# via
225234
# ipykernel
@@ -238,7 +247,9 @@ traitlets==5.14.3
238247
# nbformat
239248
# nbsphinx
240249
typing-extensions==4.12.0
241-
# via pydata-sphinx-theme
250+
# via
251+
# ipython
252+
# pydata-sphinx-theme
242253
tzdata==2024.1
243254
# via pandas
244255
urllib3==2.2.1

0 commit comments

Comments
 (0)