Flight Plots Class#

class rocketpy.plots.flight_plots._FlightPlots[source]#

Class that holds plot methods for Flight class.

Variables:
  • _FlightPlots.flight (Flight) – Flight object that will be used for the plots.

  • _FlightPlots.first_event_time (float) – Time of first event.

  • _FlightPlots.first_event_time_index (int) – Time index of first event.

__init__(flight)[source]#

Initializes _FlightPlots class.

Parameters:

flight (Flight) – Instance of the Flight class

Return type:

None

property first_event_time#

Time of the first flight event.

property first_event_time_index#

Time index of the first flight event.

trajectory_3d(*, filename=None)[source]#

Plot a 3D graph of the trajectory

Parameters:

filename (str | None, optional) – The path the plot should be saved to. By default None, in which case the plot will be shown instead of saved. Supported file endings are: eps, jpg, jpeg, pdf, pgf, png, ps, raw, rgba, svg, svgz, tif, tiff and webp (these are the formats supported by matplotlib).

Return type:

None

_resolve_animation_model_path(file_name)[source]#

Resolve model path, defaulting to the built-in STL when omitted.

_validate_animation_inputs(file_name, start, stop, time_step)[source]#

Validate shared input parameters for 3D animation methods.

static _rotation_matrix_from_quaternion(q0, q1, q2, q3)[source]#

Return the body-to-inertial homogeneous rotation matrix.

_animation_position(time_value)[source]#

Return the rocket position in the East-North-Up AGL frame, in m.

_animation_velocity(time_value)[source]#

Return inertial East-North-Up velocity at time_value, in m/s.

_animation_wind(time_value)[source]#

Return the wind velocity in the East-North-Up frame, in m/s.

static _safe_unit_vector(vector, fallback=(0.0, 0.0, 1.0))[source]#

Normalize a vector, returning a finite fallback for zero magnitude.

_animation_transformation(time_value, position=None)[source]#

Return the body-to-inertial transform at time_value.

classmethod _direction_arrow(pyvista, direction, scale, start=(0, 0, 0))[source]#

Create a slender, constant-length arrow for a vector direction.

static _animation_color_scheme()[source]#

Return the color scheme shared by both PyVista animations.

Keep animation colors in this single dictionary so the complete visual scheme can be adjusted without searching through either scene builder.

_animation_event_markers(start, stop, colors)[source]#

Return significant flight event times, labels and display colors.

static _polyline(pyvista, points, *, closed=False)[source]#

Build a connected PolyData line, optionally closed.

_animation_scalar(time_value, color_by)[source]#

Return a trajectory coloring scalar at time_value.

static _animation_scalar_metadata(color_by)[source]#

Return display label and SI unit for a trajectory scalar.

classmethod _polyline_with_scalars(pyvista, points, scalars, scalar_name)[source]#

Build a polyline carrying one point scalar array.

static _dashed_polyline(pyvista, points, *, scalars=None, scalar_name=None, dash_count=32)[source]#

Build an arc-length-spaced dashed line with optional point scalars.

_animation_kinematic_series(times)[source]#

Return altitude, speed and acceleration histories in SI units.

_animation_attitude_series(times)[source]#

Return aerodynamic-angle, Euler-angle and body-rate histories.

static _add_animation_charts(pyvista, plotter, times, chart_series, colors, *, attitude=False, compact=False)[source]#

Add compact PyVista history charts and return their time cursors.

static _update_animation_chart_cursors(cursors, time_value)[source]#

Move all chart cursors to the selected flight time.

_ground_bounds_from_spec(spec, fallback_bounds)[source]#

Convert explicit ENU or latitude/longitude image bounds to ENU.

static _interpolated_camera_path(camera_path, fraction)[source]#

Interpolate a sequence of PyVista camera positions.

classmethod _update_animation_camera(plotter, mode, position, rotation, scene_span, time_value, start, stop, camera_path)[source]#

Update the camera from a preset mode or deterministic path.

_rocket_axial_display_coordinate(value, display_length)[source]#

Map a rocket axial coordinate onto the centered display model.

_animation_phase(time_value)[source]#

Return a concise phase label for the telemetry overlay.

_trajectory_telemetry(time_value)[source]#

Format the trajectory animation’s live telemetry panel.

_rotation_telemetry(time_value, rotation, include_stability=False)[source]#

Format the attitude animation’s live telemetry panel.

_animation_background_palette(background_color=None, colors=None)[source]#

Return launch and near-space background color pairs.

static _animation_background_at_altitude(palette, altitude_agl)[source]#

Linearly blend the launch palette into near-space by 50 km AGL.

classmethod _set_animation_background(plotter, palette, altitude_agl)[source]#

Update the scene background for the current altitude.

static _style_telemetry_actor(actor, colors)[source]#

Give telemetry a compact Matplotlib-like annotation box.

static _style_legend_actor(actor, colors)[source]#

Give a PyVista legend compact scientific-plot styling.

classmethod _style_animation_plotter(plotter, palette, colors, *, show_kinematic_plots=False)[source]#

Apply RocketPy’s animation scene style.

static _style_animation_slider(widget, colors)[source]#

Apply a compact neutral style to a native PyVista slider.

static _animation_options(kwargs)[source]#

Remove and validate RocketPy-specific options from Plotter kwargs.

classmethod _resolved_animation_colors(override)[source]#

Merge a user color override into the centralized default scheme.

static _run_animation(plotter, update_frame, start, stop, time_step, playback_speed, *, colors, playback_controls=True, backend='auto', force_external=False, export_file=None, export_fps=30, transparent_background=False)[source]#

Add playback controls and start PyVista’s timer-driven event loop.

animate_trajectory(file_name=None, start=0, stop=None, time_step=0.1, playback_speed=1.0, **kwargs)[source]#

Animate the 6-DOF trajectory and attitude using PyVista.

Parameters:
  • file_name (str | None, optional) – Path to a 3D model file representing the rocket, usually .stl. If None, RocketPy uses a built-in default STL model. Default is None.

  • start (int, float, optional) – Animation start time in seconds. Default is 0.

  • stop (int, float | None, optional) – Animation end time in seconds. If None, uses flight.t_final. Default is None.

  • time_step (float, optional) – Animation frame step in seconds. Must be greater than 0. Default is 0.1.

  • playback_speed (float, optional) – Ratio of simulation time to wall-clock playback time. For example, 2 plays at twice real time. Must be greater than 0. Default is 1.

  • **kwargs (dict, optional) – RocketPy animation options and additional keyword arguments passed to pyvista.Plotter. See Notes.

  • background_color (color-like | None, optional) – Launch background override. None selects a daylight or night palette. Default is None.

  • playback_controls (bool, optional) – Display play/pause, timeline and playback-speed controls. Default is True.

  • show_subrocket_point (bool, optional) – Display the rocket’s vertical projection on the ground plane. Default is True.

  • ground_image (path-like | pyvista.Texture | mapping | None, optional) – Ground texture. A mapping may define image, bounds, coordinates ("enu" or "latlon"), and flip_y for geographic placement. Default is None.

  • color_by (str | bool | None, optional) – Trajectory point scalar, one of "speed", "mach", "dynamic_pressure", "acceleration", "altitude", False or None. Default is “speed”.

  • show_kinematic_plots (bool, optional) – Show altitude, speed and acceleration histories. Default is False.

  • camera_mode ({"static", "follow", "ground", "body"}, optional) – Camera tracking preset. Default is “static”.

  • camera_path (callable | sequence | None, optional) – Custom camera function or interpolated camera positions. Default is None.

  • backend ({"auto", "none", "trame", "client"}, optional) – Visualization backend. Default is “auto”.

  • force_external (bool, optional) – Force rendering in an external window. Default is False.

  • shadows (bool, optional) – Enable PyVista scene shadows. Scientific overlays remain unlit so their colors stay camera-independent. Default is False.

  • trajectory_line_width (float, optional) – Width of the flown trajectory; related path widths scale from this value. Default is 4.

  • export_file (path-like | None, optional) – Deterministic .gif or .mp4 output. Default is None.

  • export_fps (float, optional) – Export frame rate. Default is 30.

  • export_resolution (tuple[int, int] | None, optional) – Export width and height in pixels. Default is None.

  • transparent_background (bool, optional) – Enable GIF alpha transparency. Default is False.

  • color_scheme (mapping | None, optional) – Overrides merged into the default animation color dictionary. Default is None.

Notes

Coordinates use the inertial East-North-Up frame and metres. Altitude is above ground level. Wind arrows point in the direction the air is moving. The rocket is display-scaled so it remains visible. Native controls provide play/pause, time scrubbing and playback-speed selection.

RocketPy options accepted through kwargs are background_color, playback_controls, show_subrocket_point, ground_image, color_by, charts, camera, export, backend and styling options.

animate_rotate(file_name=None, start=0, stop=None, time_step=0.1, playback_speed=1.0, **kwargs)[source]#

Animate rocket attitude in an inertial reference scene using PyVista.

Parameters:
  • file_name (str | None, optional) – Path to a 3D model file representing the rocket, usually .stl. If None, RocketPy uses a built-in default STL model. Default is None.

  • start (int, float, optional) – Animation start time in seconds. Default is 0.

  • stop (int, float | None, optional) – Animation end time in seconds. If None, uses flight.t_final. Default is None.

  • time_step (float, optional) – Animation frame step in seconds. Must be greater than 0. Default is 0.1.

  • playback_speed (float, optional) – Ratio of simulation time to wall-clock playback time. For example, 2 plays at twice real time. Must be greater than 0. Default is 1.

  • **kwargs (dict, optional) – RocketPy animation options and additional keyword arguments passed to pyvista.Plotter. See Notes.

  • background_color (color-like | None, optional) – Launch background override. None selects a daylight or night palette. Default is None.

  • playback_controls (bool, optional) – Display play/pause, timeline and playback-speed controls. Default is True.

  • backend ({"auto", "none", "trame", "client"}, optional) – Visualization backend. Default is “auto”.

  • force_external (bool, optional) – Force rendering in an external window. Default is False.

  • shadows (bool, optional) – Enable PyVista scene shadows. Body and direction overlays remain unlit so their colors stay camera-independent. Default is False.

  • show_kinematic_plots (bool, optional) – Show altitude, speed and acceleration histories. Default is False.

  • show_attitude_plots (bool, optional) – Show aerodynamic angles, 3-1-3 Euler angles and body angular-rate histories. Default is False.

  • show_cp_cm (bool, optional) – Show dynamic center-of-mass and center-of-pressure markers and telemetry. Default is False.

  • camera_mode ({"static", "follow", "ground", "body"}, optional) – Camera tracking preset. Default is “static”.

  • camera_path (callable | sequence | None, optional) – Custom camera function or interpolated camera positions. Default is None.

  • export_file (path-like | None, optional) – Deterministic .gif or .mp4 output. Default is None.

  • export_fps (float, optional) – Export frame rate. Default is 30.

  • export_resolution (tuple[int, int] | None, optional) – Export width and height in pixels. Default is None.

  • transparent_background (bool, optional) – Enable GIF alpha transparency. Default is False.

  • color_scheme (mapping | None, optional) – Overrides merged into the default animation color dictionary. Default is None.

Notes

The fixed reference frame is East-North-Up. Body X, Y and Z correspond to pitch, yaw and roll axes respectively. Angular rates are displayed in degrees per second. Velocity and wind arrows show inertial directions at the selected time; the wind arrow points toward air motion. Native controls provide play/pause, time scrubbing and playback-speed selection.

RocketPy options accepted through kwargs are background_color, playback_controls, charts, stability markers, camera, export, backend and styling options. Trajectory-only options are accepted and ignored so shared option dictionaries can be used with both animation methods.

linear_kinematics_data(*, filename=None)[source]#

Prints out all Kinematics graphs available about the Flight

Parameters:

filename (str | None, optional) – The path the plot should be saved to. By default None, in which case the plot will be shown instead of saved. Supported file endings are: eps, jpg, jpeg, pdf, pgf, png, ps, raw, rgba, svg, svgz, tif, tiff and webp (these are the formats supported by matplotlib).

Return type:

None

attitude_data(*, filename=None)[source]#

Prints out all Angular position graphs available about the Flight

Parameters:

filename (str | None, optional) – The path the plot should be saved to. By default None, in which case the plot will be shown instead of saved. Supported file endings are: eps, jpg, jpeg, pdf, pgf, png, ps, raw, rgba, svg, svgz, tif, tiff and webp (these are the formats supported by matplotlib).

Return type:

None

flight_path_angle_data(*, filename=None)[source]#

Prints out Flight path and Rocket Attitude angle graphs available about the Flight

Parameters:

filename (str | None, optional) – The path the plot should be saved to. By default None, in which case the plot will be shown instead of saved. Supported file endings are: eps, jpg, jpeg, pdf, pgf, png, ps, raw, rgba, svg, svgz, tif, tiff and webp (these are the formats supported by matplotlib).

Return type:

None

angular_kinematics_data(*, filename=None)[source]#

Prints out all Angular velocity and acceleration graphs available about the Flight

Parameters:

filename (str | None, optional) – The path the plot should be saved to. By default None, in which case the plot will be shown instead of saved. Supported file endings are: eps, jpg, jpeg, pdf, pgf, png, ps, raw, rgba, svg, svgz, tif, tiff and webp (these are the formats supported by matplotlib).

Return type:

None

rail_buttons_bending_moments(*, filename=None)[source]#

Prints out Rail Buttons Bending Moments graphs.

Parameters:

filename (str | None, optional) – The path the plot should be saved to. By default None, in which case the plot will be shown instead of saved. Supported file endings are: eps, jpg, jpeg, pdf, pgf, png, ps, raw, rgba, svg, svgz, tif, tiff and webp (these are the formats supported by matplotlib).

Return type:

None

rail_buttons_forces(*, filename=None)[source]#

Prints out all Rail Buttons Forces graphs available about the Flight.

Parameters:

filename (str | None, optional) – The path the plot should be saved to. By default None, in which case the plot will be shown instead of saved. Supported file endings are: eps, jpg, jpeg, pdf, pgf, png, ps, raw, rgba, svg, svgz, tif, tiff and webp (these are the formats supported by matplotlib).

Return type:

None

aerodynamic_forces(*, filename=None)[source]#

Prints out all Forces and Moments graphs available about the Flight

Parameters:

filename (str | None, optional) – The path the plot should be saved to. By default None, in which case the plot will be shown instead of saved. Supported file endings are: eps, jpg, jpeg, pdf, pgf, png, ps, raw, rgba, svg, svgz, tif, tiff and webp (these are the formats supported by matplotlib).

Return type:

None

energy_data(*, filename=None)[source]#

Prints out all Energy components graphs available about the Flight

Parameters:

filename (str | None, optional) – The path the plot should be saved to. By default None, in which case the plot will be shown instead of saved. Supported file endings are: eps, jpg, jpeg, pdf, pgf, png, ps, raw, rgba, svg, svgz, tif, tiff and webp (these are the formats supported by matplotlib).

Return type:

None

fluid_mechanics_data(*, filename=None)[source]#

Prints out a summary of the Fluid Mechanics graphs available about the Flight

Parameters:

filename (str | None, optional) – The path the plot should be saved to. By default None, in which case the plot will be shown instead of saved. Supported file endings are: eps, jpg, jpeg, pdf, pgf, png, ps, raw, rgba, svg, svgz, tif, tiff and webp (these are the formats supported by matplotlib).

Return type:

None

stability_and_control_data(*, filename=None)[source]#

Prints out Rocket Stability and Control parameters graphs available about the Flight

Parameters:

filename (str | None, optional) – The path the plot should be saved to. By default None, in which case the plot will be shown instead of saved. Supported file endings are: eps, jpg, jpeg, pdf, pgf, png, ps, raw, rgba, svg, svgz, tif, tiff and webp (these are the formats supported by matplotlib).

Return type:

None

pressure_rocket_altitude(*, filename=None)[source]#

Plots out pressure at rocket’s altitude.

Parameters:

filename (str | None, optional) – The path the plot should be saved to. By default None, in which case the plot will be shown instead of saved. Supported file endings are: eps, jpg, jpeg, pdf, pgf, png, ps, raw, rgba, svg, svgz, tif, tiff and webp (these are the formats supported by matplotlib).

Return type:

None

pressure_signals()[source]#

Plots out all Parachute Trigger Pressure Signals. This function can be called also for plot pressure data for flights without Parachutes, in this case the Pressure Signals will be simply the pressure provided by the atmosphericModel, at Flight z positions. This means that no noise will be considered if at least one parachute has not been added.

This function aims to help the engineer to visually check if there are anomalies with the Flight Simulation.

Return type:

None

all()[source]#

Prints out all plots available about the Flight.

Return type:

None

static _FlightPlots__signed_angle_ylim(angle_function, t_start, t_end, margin=5)#

Return (ymin, ymax) limits for a signed angle plotted between t_start and t_end. The range is based only on the samples inside that time window so the full (positive and negative) oscillation is visible, unlike a fixed floor at zero which would clip it.