larvaworld.lib.plot.epochs
Behaviorl-epoch-related plotting
Functions
|
Plot single behavioral bout duration distribution with fitted curves. |
|
Plot behavioral bout distributions across datasets. |
Module Contents
- larvaworld.lib.plot.epochs.plot_single_bout(x0: Sequence[float], bout: str, color: str, label: str, ax: Any, fit_dic: dict | None = None, plot_fits: str | Sequence[str] = 'best', marker: str = '.', legend_outside: bool = False, xlabel: str = 'time (sec)', xlim: Sequence[float] | None = None, **kwargs: Any) None
Plot single behavioral bout duration distribution with fitted curves.
Creates log-log plot of bout duration probability distribution with optional fitted distribution curves (powerlaw, exponential, etc.).
- Args:
x0: Bout duration data bout: Bout type label (‘pauses’, ‘runs’, etc.) color: Color for data points label: Legend label for this dataset ax: Matplotlib axes to plot on fit_dic: Pre-computed fit results. If None, computes fits plot_fits: Which fits to show (‘best’, ‘all’, or list). Defaults to ‘best’ marker: Marker style for data points. Defaults to ‘.’ legend_outside: Place legend outside plot. Defaults to False xlabel: X-axis label. Defaults to ‘time (sec)’ xlim: X-axis limits. Defaults to None **kwargs: Additional arguments passed to fit_bout_distros
- Example:
>>> plot_single_bout(pause_data, 'pauses', 'red', 'Control', ax)
- larvaworld.lib.plot.epochs.plot_bouts(name: str | None = None, plot_fits: str | Sequence[str] = '', print_fits: bool = False, turns: bool = False, stridechain_duration: bool = False, legend_outside: bool = False, **kwargs: Any) Any
Plot behavioral bout distributions across datasets.
Creates two-panel plots showing distributions of bout durations (runs/pauses or turn durations/amplitudes) with fitted distribution curves.
- Args:
name: Plot name for saving. Auto-generated if None plot_fits: Which distribution fits to display (‘best’, ‘all’, or list). Defaults to ‘’ print_fits: Whether to print fit parameters. Defaults to False turns: Plot turn epochs instead of run/pause. Defaults to False stridechain_duration: Use run duration instead of stride count. Defaults to False legend_outside: Place legend outside plots. Defaults to False **kwargs: Additional arguments passed to AutoPlot
- Returns:
Plot output (figure object or None based on return_fig setting)
- Example:
>>> fig = plot_bouts(datasets=[d1, d2], plot_fits='best', turns=False)