pycea.pl.n_extant#
- pycea.pl.n_extant(tdata, color=None, *, data=None, key='n_extant', depth_key=None, n_extant_key=None, stat='count', order=None, palette=None, na_color='lightgray', legend=None, ax=None, legend_kwargs=None)#
Plot extant branches over time.
- Parameters:
tdata (
TreeData) – The TreeData object.color (
Sequence[str] |str|None(default:None)) – Column(s) indatato color by. Determined fromdatawhenNone.data (
DataFrame|None(default:None)) – Extant counts to plot. Usestdata.uns[key]ifNone.key (
str(default:'n_extant')) – Key intdata.unsstoring extant counts whendataisNone.depth_key (
str|None(default:None)) – Column storing time or depth values. IfNone, uses the first column indata.n_extant_key (
str|None(default:None)) – Column storing extant counts. IfNone, uses the second column indata.stat (
Literal['count','proportion','percent'] (default:'count')) – Statistic to compute for the ribbons: ‘count’, ‘fraction’, or ‘percent’.order (
Sequence[str] |None(default:None)) – Order of group categories in the stack.palette (
dict[str,str] |None(default:None)) – Colors to use for plotting categorical annotation groups. The palette can be a validListedColormapname ('Set2','tab20', …), aCyclerobject, a dict mapping categories to colors, or a sequence of colors. Colors must be valid to matplotlib. (seeis_color_like()). IfNone,mpl.rcParams["axes.prop_cycle"]is used unless the categorical variable already has colors stored intdata.uns["{var}_colors"]. If provided, values oftdata.uns["{var}_colors"]will be set.na_color (
str|None(default:'lightgray')) – The color to use for annotations with missing data.legend (
bool|None(default:None)) – Whether to add a legend to the plot. By default, a legend is added if there are <= 20 distinct categories.ax (
Axes|None(default:None)) – Axes on which to draw the plot. Creates new axes whenNone.legend_kwargs (
dict[str,Any] |None(default:None)) – Additional keyword arguments for the legend.
- Return type:
- Returns:
ax - Axis containing the ribbon plot.