Plot

utils.plot.module_usage_sandplot(config, module_usage, remap=False, title=None, legend=True, long_legend=True, figW=7, figH=3, convolve=False, window=5)[source]

new sandplot function

Parameters:
  • config – the config object

  • module_usage

  • BORIS_to_pose_mat – optional BORIS_to_pose_mat from analyze.boris_to_pose to re-align modules by their most overlapping manually scored behavior class

  • title

  • legend – plot legend or not

  • long_legend

  • convolve

  • window

Returns:

utils.plot.network_plot(config, labels_df=None, module_usage=None, module_transitions=None, cmap='bwr', include_labels=True, scaling=1, tscale=6, figW=2.8, figH=2.5, alt_labels=None)[source]

Plot network comparison. You must provide EITHER labels_df OR module_usage and module_tsransitions

Parameters:
  • config – project config object

  • labels_df – labels_df for two groups to be compared; if provided, ModuleUsage and ModuleTransitions will be computed

  • module_usage – ModuleUsage object for comparison between two groups (not needed if labels_df is provided)

  • module_transitions – ModuleTransitions object for comparison between two groups (not needed if labels_df is provided)

  • cmap – color map

  • include_labels – True or False; default True

  • scaling – controls size of nodes in network plot; larger –> bigger; default 1

  • tscale – vmax and vmin for tscore; default 6

  • figW – figure width

  • figH – figure height

  • alt_labels – possible alt labels

Returns:

utils.plot.plot_action_units(config, action_units, figW=4, figH=2, style='bar_scatter', cmap='jet', legend_pos='outside_right', legend=True, alt_labels=None, alt_xticks=None, title=None, plot_stats=False)[source]

Plot mean action units

Parameters:
  • config – config

  • action_units – output of analyze.get_action_units

  • figW – figure width (default: 4)

  • figH – figure height (default: 2)

  • style – plot style; “bar_scatter”, “bar_error”, “points”

  • cmap – colormap (default: jet)

  • legend_pos – legend position (default: outside)

  • legend – boolean to include or not include legend (default: False)

  • alt_labels – alternative group label dictionary (default: None)

  • alt_xticks – alternative xticklabels (list), for stacked plot style only (default: None)

  • title – plot title (default: None)

  • plot_stats – include stats on plot (default: False)

Returns:

fig

utils.plot.plot_distance_box(module_feature_object, dist_mat, cmap='Blues', figW=3, figH=3, alt_labels=None, title=None)[source]

Plot distance boxplot

Parameters:
  • module_feature_object

  • dist_mat

  • cmap

  • figW

  • figH

  • alt_labels

  • title

Returns:

utils.plot.plot_distance_matrix(module_feature_object, dist_mat, cmap='Greens', figW=3, figH=3, alt_labels=None, title=None)[source]

Plot distance matrix

Parameters:
  • module_feature_object

  • dist_mat

  • cmap

  • figW

  • figH

  • alt_labels

  • title

Returns:

utils.plot.plot_distance_results(module_feature_object, distance_results, figW=3, figH=3, cmap='Blues', title=None)[source]

Plot results from distance computation

Parameters:
  • module_feature_object

  • distance_results

  • figW

  • figH

  • cmap

  • title

Returns:

utils.plot.plot_embeddings(module_feature_object, embeddings_object, figW=3, figH=3, cmap='viridis', title=None, legend=False, draw_ellipse=True, alt_legend=None)[source]

Plot embeddings

Parameters:
  • module_feature_object – module feature object (ModuleUsage or ModuleTransitions) from analyze.get_module_{xx}

  • embeddings_object – embeddings object (LDA or PCA) from analyze.embed

  • figW – figure width

  • figH – figure height

  • cmap – matplotlib colormap

  • title – title string, or None

  • legend – True or False

Returns:

fig

utils.plot.plot_keypoint_kinematics(config, kinematics, figW=4, figH=2, style='bar_scatter', cmap='jet', legend_pos='outside_right', legend=True, alt_labels=None, alt_xticks=None, title=None, plot_stats=False)[source]

Plot mean action units

Parameters:
  • config – config

  • action_units – output of analyze.get_keypoint_kinematics

  • figW – figure width (default: 4)

  • figH – figure height (default: 2)

  • style – plot style; “bar_scatter”, “bar_error”, “points”

  • cmap – colormap (default: jet)

  • legend_pos – legend position (default: outside)

  • legend – boolean to include or not include legend (default: False)

  • alt_labels – alternative group label dictionary (default: None)

  • alt_xticks – alternative xticklabels (list), for stacked plot style only (default: None)

  • title – plot title (default: None)

  • plot_stats – include stats on plot (default: False)

Returns:

fig

utils.plot.plot_keypoint_travel(keypoint_feature, cmap='viridis', plottype='band', figW=6, figH=3)[source]

Plots displacement of a keypoint either over time or in bins from dist_df (output of analyze.dist_df_subgroups)

Parameters:
  • dist_df – dist_df output from analyze.dist_df_subgroups

  • cmap – matplotlib colormap

  • plottype – type of plot (“band”, “errorbar”, or “bar” if no timebins)

  • figW – figure width

  • figH – figure height

Returns:

utils.plot.plot_module_usage(config, usage_feats, figW=4, figH=2, style='bar_scatter', cmap='jet', legend_pos='outside_right', remap=False, legend=True, long_legend=False, alt_labels=None, alt_xticks=None, title=None, plot_stats=False)[source]

Plot module usage

Parameters:
  • config – config

  • usage_feats – output of analyze.get_module_usage

  • figW – figure width (default: 4)

  • figH – figure height (default: 2)

  • style – plot style; “bar_scatter”, “bar_error”, “points”, or “stacked”

  • cmap – colormap (default: jet)

  • legend_pos – legend position (default: outside)

  • remap – whether to remap modules acording to config[“remappings”] (default: False)

  • legend – boolean to include or not include legend (default: False)

  • long_legend – long legend (default: False)

  • alt_labels – alternative group label dictionary (default: None)

  • alt_xticks – alternative xticklabels (list), for stacked plot style only (default: None)

  • title – plot title (default: None)

  • plot_stats – include stats on plot (default: False)

Returns:

fig