src.visualization package

src.visualization.plot module

This module contains various plotting functions. Not all of them are actually used in the pipeline but could be potentially useful. Some plotting functions can be stacked, resulting in complex plots. Therefore, show() needs to be called manually to display the plots.

src.visualization.plot.plot_1d(y, x=None)

Plot a 1D array. Generate regular spacing if x is None.

Parameters
  • y (list[float]) – y values

  • x (list[float]) – optional - value spacing

Returns

None

src.visualization.plot.plot_2d_lateral_view(position, stance=None, as_subplot=False)

Plots trajectory in 2D (lateral view, height and distance from origin). Optionally mark stance phase. Optionally add this as subplot. Used to overlay multiple steps.

Parameters
  • position (np.array) – 3D position for each timestep

  • stance (np.array) – optional bool array, indicating stance phase

  • as_subplot (bool) – used if called from plot_steps()

Returns

None

src.visualization.plot.plot_3d_view(position)

Plots 3D trajectory.

Parameters

position (np.array) – 3D coordinates for each timestep

Returns

None

src.visualization.plot.plot_3d_view_speed(position, speed)

Plots 3D trajectory colored by speed.

Parameters
  • position (np.array) – 3D position for each timestep

  • speed (np.array) – speed for each timestep

Returns

None

src.visualization.plot.plot_3d_view_with_stance(position, stance)

Plots trajectory in 3D and colors stance phases differently.

Parameters
  • position (np.array) – 3D position for each timestep

  • stance (np.array) – bool array indicating stance for each timestep

Returns

None

src.visualization.plot.plot_accel_gyro(imu)

Plots acceleration and gyroscope raw values.

Parameters

imu (IMU) – IMU object with data to plot

Returns

None

src.visualization.plot.plot_gyro_magnitude(imu, stance=None, threshold=None)

Plot gyroscope magnitude

Parameters
  • imu (IMU) – IMU object with data

  • stance (np.array) – optional stance indicators. If set, an overlay is plotted

  • threshold (float) – optional - If set, a horizontal line at the specified height is drawn

Returns

None

src.visualization.plot.plot_imu_accel_mag(imu)

Plots acceleration magnitude.

Parameters

imu (IMU) – IMU object with data to plot

Returns

None

src.visualization.plot.plot_multi_3d_view(positions)

Plots multiple trajectories in one 3D graph.

Parameters

positions (list[np.array]) – multiple arrays of 3D coordinates for each timestep

Returns

None

src.visualization.plot.plot_stance_overlay(time, stance)

Plot transparent overlay during stance phases. This makes it easy to visualize stance phases in any signal plot and adapt the threshold that is used to identify these phases.

Parameters

stance (np.array) – bool array, indicating stance for each timestep

Returns

None

src.visualization.plot.plot_steps(steps)

Plots a 2D view of overlayed steps. This can be used to compare the shape of trajectories of different steps.

Parameters

steps (list[np.array]) – multiple arrays of 3D coordinates for each timestep

Returns

None

src.visualization.plot.set_3d_axes_equal(ax, data)

Sets all axes to an equal scale. Note: ax.set_aspect(‘equal’) is not available for 3D.

Parameters
  • ax (matplotlib.axes) – Axes of the plot

  • data (np.array) – 3D data that is plotted along the axes

Returns

None

src.visualization.plot.set_3d_xy_axes_equal(ax, data)

Sets horizontal axes to an equal scale. This is relevant for displaying foot trajectories. Since the height of a step is very small compared to the length, horizontal and vertical axes should be scaled differently in order to see actual change along the vertical axis.

Parameters
  • ax (matplotlib.axes) – Axes of the plot

  • data (np.array) – 3D data that is plotted along the axes

Returns

None

src.visualization.plot.show()

Shows the plot. Proxy for plt.show() so matplotlib.pyplot doesnt have to be imported.