ridgeplot._types¶
Miscellaneous types, type aliases, and related utilities.
- ridgeplot._types.CollectionL1¶
A
TypeAlias
for a 1-level-deepCollection
.Example
>>> c1 = [1, 2, 3]
alias of
Collection
[_T
]
- ridgeplot._types.CollectionL2¶
A
TypeAlias
for a 2-level-deepCollection
.Example
>>> c2 = [[1, 2, 3], [4, 5, 6]]
alias of
Collection
[Collection
[_T
]]
- ridgeplot._types.CollectionL3¶
A
TypeAlias
for a 3-level-deepCollection
.Example
>>> c3 = [ ... [[1, 2], [3, 4]], ... [[5, 6], [7, 8]], ... ]
alias of
Collection
[Collection
[Collection
[_T
]]]
- class ridgeplot._types.NumericT¶
A
TypeVar
variable bound toNumeric
types.alias of TypeVar(‘NumericT’, bound=
int
|np.integer[Any]
|float
|np.floating[Any]
)
- ridgeplot._types._is_numeric(obj: int | integer[Any] | float | floating[Any]) Literal[True] [source]¶
- ridgeplot._types._is_numeric(obj: Any) bool
Check if the given object is a
Numeric
type.
- ridgeplot._types.XYCoordinate¶
A 2D \((x, y)\) coordinate, represented as a
tuple
of twoNumeric
values.Example
>>> xy_coord = (1, 2)
- ridgeplot._types.DensityTrace¶
A 2D line/trace represented as a collection of \((x, y)\) coordinates (i.e.
XYCoordinate
s).These are equivalent:
DensityTrace
CollectionL1[XYCoordinate]
Collection[Tuple[Numeric, Numeric]]
By convention, the \(x\) values should be non-repeating and increasing. For instance, the following is a valid 2D line trace:
>>> density_trace = [(0, 0), (1, 1), (2, 2), (3, 1), (4, 0)]
alias of
Collection
[Tuple
[Any
,Any
]]
- ridgeplot._types.DensitiesRow¶
A
DensitiesRow
represents a set ofDensityTrace
s that are to be plotted on a given row of a ridgeplot.These are equivalent:
DensitiesRow
CollectionL2[XYCoordinate]
Collection[Collection[Tuple[Numeric, Numeric]]]
Example
>>> densities_row = [ ... [(0, 0), (1, 1), (2, 0)], # Trace 1 ... [(1, 0), (2, 1), (3, 2), (4, 1)], # Trace 2 ... [(3, 0), (4, 1), (5, 2), (6, 1), (7, 0)], # Trace 3 ... ]
alias of
Collection
[Collection
[Tuple
[Any
,Any
]]]
- ridgeplot._types.Densities¶
The
Densities
type represents the entire collection of traces that are to be plotted on a ridgeplot.In a ridgeplot, several traces can be plotted on different rows. Each row is represented by a
DensitiesRow
object which, in turn, is a collection ofDensityTrace
s. Therefore, theDensities
type is a collection ofDensitiesRow
s.These are equivalent:
Densities
CollectionL1[DensitiesRow]
CollectionL3[XYCoordinate]
Collection[Collection[Collection[Tuple[Numeric, Numeric]]]]
Example
>>> densities = [ ... [ # Row 1 ... [(0, 0), (1, 1), (2, 0)], # Trace 1 ... [(1, 0), (2, 1), (3, 2), (4, 1)], # Trace 2 ... [(3, 0), (4, 1), (5, 2), (6, 1), (7, 0)], # Trace 3 ... ], ... [ # Row 2 ... [(-2, 0), (-1, 1), (0, 0)], # Trace 5 ... [(0, 0), (1, 1), (2, 1), (3, 0)], # Trace 6 ... ], ... ]
alias of
Collection
[Collection
[Collection
[Tuple
[Any
,Any
]]]]
- ridgeplot._types.ShallowDensities¶
Shallow type for
Densities
where each row of the ridgeplot contains only a single trace.These are equivalent:
Densities
CollectionL1[DensityTrace]
CollectionL2[XYCoordinate]
Collection[Collection[Tuple[Numeric, Numeric]]]
Example
>>> shallow_densities = [ ... [(0, 0), (1, 1), (2, 0)], # Trace 1 ... [(1, 0), (2, 1), (3, 0)], # Trace 2 ... [(2, 0), (3, 1), (4, 0)], # Trace 3 ... ]
alias of
Collection
[Collection
[Tuple
[Any
,Any
]]]
- ridgeplot._types.is_shallow_densities(obj: Collection[Collection[Tuple[Any, Any]]]) Literal[True] [source]¶
- ridgeplot._types.is_shallow_densities(obj: Any) bool
Check if the given object is a
ShallowDensities
type.
- ridgeplot._types.SamplesTrace¶
A
SamplesTrace
is a collection of numeric values representing a set of samples from which aDensityTrace
can be estimated via KDE.Example
>>> samples_trace = [0, 1, 1, 2, 2, 2, 3, 3, 4]
alias of
Collection
[int
|np.integer[Any]
|float
|np.floating[Any]
]
- ridgeplot._types.SamplesRow¶
A
SamplesRow
represents a set ofSamplesTrace
s that are to be plotted on a given row of a ridgeplot.i.e. a
SamplesRow
is a collection ofSamplesTrace
s and can be converted into aDensitiesRow
by applying KDE to each trace.Example
>>> samples_row = [ ... [0, 1, 1, 2, 2, 2, 3, 3, 4], # Trace 1 ... [1, 2, 2, 3, 3, 3, 4, 4, 5], # Trace 2 ... ]
alias of
Collection
[Collection
[int
|np.integer[Any]
|float
|np.floating[Any]
]]
- ridgeplot._types.Samples¶
The
Samples
type represents the entire collection of samples that are to be plotted on a ridgeplot.It is a collection of
SamplesRow
objects. Each row is represented by aSamplesRow
type which, in turn, is a collection ofSamplesTrace
s which can be converted intoDensityTrace
‘s by applying a kernel density estimation algorithm.Therefore, the
Samples
type can be converted into aDensities
type by applying a kernel density estimation (KDE) algorithm to each trace.See
Densities
for more details.Example
>>> samples = [ ... [ # Row 1 ... [0, 1, 1, 2, 2, 2, 3, 3, 4], # Trace 1 ... [1, 2, 2, 3, 3, 3, 4, 4, 5], # Trace 2 ... ], ... [ # Row 2 ... [2, 3, 3, 4, 4, 4, 5, 5, 6], # Trace 3 ... [3, 4, 4, 5, 5, 5, 6, 6, 7], # Trace 4 ... ], ... ]
alias of
Collection
[Collection
[Collection
[int
|np.integer[Any]
|float
|np.floating[Any]
]]]
- ridgeplot._types.ShallowSamples¶
Shallow type for
Samples
where each row of the ridgeplot contains only a single trace.Example
>>> shallow_samples = [ ... [0, 1, 1, 2, 2, 2, 3, 3, 4], # Trace 1 ... [1, 2, 2, 3, 3, 3, 4, 4, 5], # Trace 2 ... ]
alias of
Collection
[Collection
[int
|np.integer[Any]
|float
|np.floating[Any]
]]
- ridgeplot._types.is_shallow_samples(obj: Collection[Collection[int | integer[Any] | float | floating[Any]]]) Literal[True] [source]¶
- ridgeplot._types.is_shallow_samples(obj: Any) bool
Check if the given object is a
ShallowSamples
type.