pingouin.plot_circmean#

pingouin.plot_circmean(angles, square=True, ax=None, kwargs_markers=None, kwargs_arrow=None)[source]#

Plot the circular mean and vector length of a set of angles on the unit circle.

Added in version 0.3.3.

Parameters:
anglesarray or list

Angles (expressed in radians). Only 1D array are supported here.

square: bool

If True (default), ensure equal aspect ratio between X and Y axes.

axmatplotlib axes

Axis on which to draw the plot.

kwargs_markersdict or None

Optional keywords arguments that are passed to matplotlib.axes.Axes.plot to control the markers aesthetics. When None, internal defaults are used. Matplotlib aliases and their canonical names (e.g. ms and markersize) are interchangeable.

kwargs_arrowdict or None

Optional keywords arguments that are passed to matplotlib.axes.Axes.arrow to control the arrow aesthetics. When None, internal defaults are used. Matplotlib aliases and their canonical names (e.g. fc and facecolor) are interchangeable.

Returns:
axMatplotlib Axes instance

Returns the Axes object with the plot for further tweaking.

Examples

Default plot

>>> import pingouin as pg
>>> ax = pg.plot_circmean([0.05, -0.8, 1.2, 0.8, 0.5, -0.3, 0.3, 0.7])
../_images/pingouin-plot_circmean-1.png

Changing some aesthetics parameters

>>> import pingouin as pg
>>> import matplotlib.pyplot as plt
>>> _, ax = plt.subplots(1, 1, figsize=(3, 3))
>>> ax = pg.plot_circmean(
...     [0.05, -0.8, 1.2, 0.8, 0.5, -0.3, 0.3, 0.7],
...     kwargs_markers=dict(color="k", mfc="k"),
...     kwargs_arrow=dict(ec="k", fc="k"),
...     ax=ax,
... )
../_images/pingouin-plot_circmean-2.png
>>> import pingouin as pg
>>> import seaborn as sns
>>> sns.set_theme(font_scale=1.5, style="white")
>>> ax = pg.plot_circmean(
...     [0.8, 1.5, 3.14, 5.2, 6.1, 2.8, 2.6, 3.2], kwargs_markers=dict(marker="None")
... )
../_images/pingouin-plot_circmean-3.png