ridgeplot.ridge_plot
This module contains the main function to plot ridgeplots.
ridgeplot(ax, data, xlim=None, fill_colors=None, line_colors=None, label_size=10.0, fill_alpha=0.5)
plotting a ridgeplot
Example
>>> import numpy as np
>>> import matplotlib.pyplot as plt
>>> from ridgeplot.ridge_plot import ridgeplot
>>> data = {}
>>> for i in range(10):
>>> data['data_{}'.format(i)] = np.random.randn(100) * (i+1)
>>> fig = plt.figure()
>>> ax = fig.add_subplot(111)
>>> ridgeplot(ax, data, xlim=(-20,20))
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ax |
Axes
|
a matplotlib ax object for writing the plot |
required |
data |
dict[str, list[float]]
|
a dictionary of data, key is the label of the group, values are the data values in the group |
required |
xlim |
Optional[tuple[float, float]]
|
x-limits for the plot (xmin, xmax) |
None
|
fill_colors |
Optional[list[str]]
|
colors for the fill under the distribution, must be same length as input data (default: all steelblue) |
None
|
line_colors |
Optional[list[str]]
|
colors for the line drawing the distribution, must be same length as input data (default: all white) |
None
|
label_size |
float
|
label size of the name of each distribution |
10.0
|
fill_alpha |
float
|
alpha value for the fill under the distribution (default: 0.5) |
0.5
|
Returns:
Type | Description |
---|---|
None
|
NoneType |
Source code in src/ridgeplot/ridge_plot.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
|