ridgeplot._obj.traces.base module

Base trace object and utilities.

ridgeplot._obj.traces.base._D3HF = '.7'

Default (d3-format) format for floats in hover labels.

After trying to read through the plotly.py source code, I couldn’t find a simple way to replicate the default hover format using the d3-format syntax in Plotly’s ‘hovertemplate’ parameter. The closest I got was by using the string below, but it’s not quite the same… (see ‘.7~r’ as well)

ridgeplot._obj.traces.base._DEFAULT_HOVERTEMPLATE = '(%{x:.7}, %{customdata[0]:.7})<br><extra>%{fullData.name}</extra>'

Default hovertemplate for density traces.

The default hover template that should be used for all density traces. It displays the x and y values of the hovered point, as well as the trace’s name. When using this as hovertemplate=DEFAULT_HOVERTEMPLATE, it is expected that the trace’s customdata is set to a list of lists, where each inner list contains a single element that is the y-value of the corresponding x-value (e.g. customdata=[[y_i] for y_i in y]). The name attribute of the trace should also be set to the desired label for the trace (e.g. name=self.label).

class ridgeplot._obj.traces.base.ColoringContext(colorscale: 'ColorScale', fillgradient: 'bool', opacity: 'float | None', interpolation_ctx: 'InterpolationContext')[source]

Bases: object

colorscale: ColorScale
fillgradient: bool
opacity: float | None
interpolation_ctx: InterpolationContext
class ridgeplot._obj.traces.base.RidgeplotTrace(*, trace, legend_ctx, solid_color, zorder, y_base, line_color, line_width)[source]

Bases: ABC

_DEFAULT_LINE_WIDTH: ClassVar[float] = 2.0
line_color: Color
line_width: float
_abc_impl = <_abc._abc_data object>
property _common_trace_kwargs: dict[str, Any]

Return common trace kwargs.

abstract draw(fig, coloring_ctx)[source]