Skip to content

Commit 85c2d06

Browse files
committed
Add docstring, shorten name to ridgeplot
1 parent 89d993a commit 85c2d06

2 files changed

Lines changed: 21 additions & 1 deletion

File tree

docs/utilities.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ else.
2424

2525
::: extra.utils.hyperslicer2
2626

27+
::: extra.utils.ridgeplot
28+
2729
## Fitting functions
2830

2931
::: extra.utils.fit_gaussian

src/extra/utils/misc.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,25 @@ def hyperslicer2(arr, *args, ax=None, lognorm=False, colorbar=True, **kwargs):
196196
return controls
197197

198198

199-
def ridgeline_plot(data, *, overlap=0.5, xlabel=None, ylabel=None, stack_label=None, stack_ticklabels=None):
199+
def ridgeplot(data, *, overlap=0.5, xlabel=None, ylabel=None, stack_label=None, stack_ticklabels=None):
200+
"""Make a ridgeline plot showing a sequence of similar lines
201+
202+
A ridgeline plot spreads out the different lines vertically to make their
203+
order clear, but allowing them to overlap. It's an alternative to a heatmap,
204+
especially if there are relatively few rows (around 5-20).
205+
206+
Args:
207+
data (array_like): A 2D array, each row of which will be plotted as one
208+
line, starting at the top of the plot. Pass an xarray DataArray to
209+
use its labels by default.
210+
overlap (float): Number from 0 (no overlap) to 1, the fraction of each
211+
plot's area covered by the next plot.
212+
xlabel (str): Label for the shared x axis.
213+
ylabel (str): Label for the y axis (drawn on the bottom plot).
214+
stack_label (str): Label for the stacking axis (shown on the right)
215+
stack_ticklabels (array_like): Labels for each line (shown on the right
216+
next to the zero line of each plot).
217+
"""
200218
import matplotlib.pyplot as plt
201219
import matplotlib.gridspec as grid_spec
202220
from matplotlib.transforms import blended_transform_factory

0 commit comments

Comments
 (0)