Plotting (.plots)
Plotting (.plots)#
Most variables can easily be plotted with matplotlib or pandas as most data in this package is contained in dataframes. Some plotting is tedious however and these are functions for those plots.
- worklab.plots.acc_peak_dist_plot(time, acc, dist, name='')[source]#
Plot acceleration and distance versus time, with acc_peak
- Parameters
time (np.array, pd.Series) – time structure
acc (np.array, pd.Series) – acceleration structure
dist (np.array, pd.Series) – distance structure
name (str) – name of a session
- Returns
ax
- Return type
axis object
- worklab.plots.acc_peak_plot(time, acc, name='')[source]#
Plot acceleration versus time, with acc_peak
- Parameters
time (np.array, pd.Series) – time structure
acc (np.array, pd.Series) – acceleration structure
name (str) – name of a session
- Returns
ax
- Return type
axis object
- worklab.plots.acc_plot(time, acc, name='')[source]#
Plot acceleration versus time
- Parameters
time (np.array, pd.Series) – time structure
acc (np.array, pd.Series) – acceleration structure
name (str) – name of a session
- Returns
ax
- Return type
axis object
- worklab.plots.bland_altman_plot(data1, data2, ax=None, condition=None)[source]#
Make a Bland-Altman plot.
A Bland–Altman plot (Difference plot) is a method of data plotting used in analyzing the agreement between two different assays.
- Parameters
data1 (np.array, pd.Series) – First variable
data2 (np.array, pd.Series) – Second variable
ax (axis object, optional) – Axis to plot on, you can add your own, or it will make a new one.
condition (str, optional) – add labels to the plot
- Returns
ax
- Return type
axis object
- worklab.plots.imu_push_plot(sessiondata, acc_frame=True, name='', dec=False)[source]#
Plot push detection with IMUs
- Parameters
sessiondata (dict or pd.Series) – processed sessiondata structure or pd.Series with frame data
acc_frame (boolean) – set to True if frame acceleration is used, if False the wheel is used
name (str) – name of a session
dec (boolean) – set to True if main deceleration should be found
- Returns
ax
- Return type
axis object
- worklab.plots.plot_power_speed_dist(data, title='', ylim_power=None, ylim_speed=None, ylim_distance=None)[source]#
Plot power, speed and distance versus time for left (solid line) and right (dotted line) separately
Figure scales automatically, unless you specify it manually with the ylim_* arguments
- Parameters
data (dict) – processed ergometer data dictionary with dataframes
title (str) – a title for the plot
ylim_power (list [min, max] of float or int, optional) – list of the minimal and maximal ylim for power in W
ylim_speed (list [min, max] of floats or int, optional) – list of the minimal and maximal ylim for speed in km/h
ylim_distance (list [min, max] of floats or int, optional) – list of the minimal and maximal ylim for distance in m
- Returns
fig (matplotlib.figure.Figure)
axes (tuple) – the three axes objects
- worklab.plots.plot_pushes(data, pushes, var='torque', start=True, stop=True, peak=True, ax=None)[source]#
Plot pushes from measurement wheel or ergometer data.
- Parameters
data (pd.DataFrame) – measurement wheel dataframe or the selected side from the ergometer dict, left, right or mean
pushes (pd.DataFrame) – measurement wheel push by push dataframe or the selected side from the ergometer dict, left, right or mean
var (str) – variable to plot, default is torque
start (bool) – plot push starts, default is True
stop (bool) – plot push stops, default is True
peak (bool) – plot push peaks, default is True
ax (axis object) – Axis to plot on, you can add your own, or it will make a new one.
- Returns
ax
- Return type
axis object
- worklab.plots.plot_pushes_ergo(data, pushes, title=None, var='power', start=True, stop=True, peak=True)[source]#
Plot left, right and mean side ergometer push data
- Parameters
data (dict) – processed ergometer data dictionary with dataframes
pushes (dict) – processed push_by_push ergometer data dictionary with dataframes
title (str) – title of the plot, optional
var (str) – variable to plot, default is power
start (bool) – plot push starts, default is True
stop (bool) – plot push stops, default is True
peak (bool) – plot push peaks, default is True
- Returns
axes – an array containing an axis for the left, right and mean side
- Return type
np.array
- worklab.plots.rot_vel_plot(time, rot_vel, name='')[source]#
Plot rotational velocity versus time
- Parameters
time (np.array, pd.Series) – time structure
rot_vel (np.array, pd.Series) – rotational velocity structure
name (str) – name of a session
- Returns
ax
- Return type
axis object
- worklab.plots.set_axes_equal_3d(axes)[source]#
Set 3D plot axes to equal scale and size
- Parameters
axes (matplotlib.axes._subplots.Axes3DSubplot) – axes containing 3D plotted data
- worklab.plots.vel_peak_dist_plot(time, vel, dist, name='')[source]#
Plot velocity and distance against time
- Parameters
time (np.array, pd.Series) – time structure
vel (np.array, pd.Series) – velocity structure
dist (np.array, pd.Series) – distance structure
name (str) – name of a session
- Returns
ax
- Return type
axis object