Skip to content

ragraph.plot.generic

RaGraph generic plotting classes

Component

Component(
    width: Optional[float] = None,
    height: Optional[float] = None,
    traces: Optional[List[BaseTraceType]] = None,
    shapes: Optional[List[Dict[str, Any]]] = None,
    annotations: Optional[List[Dict[str, Any]]] = None,
    xaxis: Optional[
        Union[go.layout.XAxis, Dict[str, Any]]
    ] = None,
    yaxis: Optional[
        Union[go.layout.YAxis, Dict[str, Any]]
    ] = None,
)

Bases: Mapping

Plot component. The basic building block to create compound Plotly figures with.

Parameters:

Name Type Description Default
width Optional[float]

Width in pixels.

None
height Optional[float]

Height in pixels.

None
traces Optional[List[BaseTraceType]]

Traces to plot in this domain.

None
shapes Optional[List[Dict[str, Any]]]

SVG shapes from this component.

None
xaxis Optional[Union[XAxis, Dict[str, Any]]]

Plotly X-axis options.

None
yaxis Optional[Union[YAxis, Dict[str, Any]]]

Plotly Y-axis options.

None
Source code in ragraph/plot/generic.py
def __init__(
    self,
    width: Optional[float] = None,
    height: Optional[float] = None,
    traces: Optional[List[BaseTraceType]] = None,
    shapes: Optional[List[Dict[str, Any]]] = None,
    annotations: Optional[List[Dict[str, Any]]] = None,
    xaxis: Optional[Union[go.layout.XAxis, Dict[str, Any]]] = None,
    yaxis: Optional[Union[go.layout.YAxis, Dict[str, Any]]] = None,
):
    if isinstance(xaxis, dict):
        _xaxis = deepcopy(self._defaults["xaxis"])
        for k, v in xaxis.items():
            setattr(_xaxis, k, v)
        xaxis = _xaxis

    if isinstance(yaxis, dict):
        _yaxis = deepcopy(self._defaults["yaxis"])
        for k, v in yaxis.items():
            setattr(_yaxis, k, v)
        yaxis = _yaxis

    super().__init__(
        width=width,
        height=height,
        traces=traces,
        shapes=shapes,
        annotations=annotations,
        xaxis=xaxis,
        yaxis=yaxis,
    )

annotations

annotations() -> List[Dict[str, Any]]

Annotations from this component.

Source code in ragraph/plot/generic.py
@field
def annotations(self) -> List[Dict[str, Any]]:  # type: ignore
    """Annotations from this component."""

get_figure

1
2
3
get_figure(
    style: Style = Style(), show: bool = True
) -> Optional[go.Figure]

Get a Plotly figure of this component alone.

Source code in ragraph/plot/generic.py
def get_figure(self, style: Style = Style(), show: bool = True) -> Optional[go.Figure]:
    """Get a Plotly figure of this component alone."""
    from ragraph.plot.utils import get_subplots, process_fig

    fig = get_subplots([[self]], style=style)
    return process_fig(fig, style=style, show=show)

height

height() -> float

Height in pixels.

Source code in ragraph/plot/generic.py
@field
def height(self) -> float:  # type: ignore
    """Height in pixels."""

shapes

shapes() -> List[Dict[str, Any]]

SVG shapes from this component.

Source code in ragraph/plot/generic.py
@field
def shapes(self) -> List[Dict[str, Any]]:  # type: ignore
    """SVG shapes from this component."""

traces

traces() -> List[BaseTraceType]

Traces to plot in this domain.

Source code in ragraph/plot/generic.py
@field
def traces(self) -> List[BaseTraceType]:  # type: ignore
    """Traces to plot in this domain."""

width

width() -> float

Width in pixels.

Source code in ragraph/plot/generic.py
@field
def width(self) -> float:  # type: ignore
    """Width in pixels."""

xaxis

xaxis() -> go.layout.XAxis

Plotly X-axis options.

Source code in ragraph/plot/generic.py
@field
def xaxis(self) -> go.layout.XAxis:  # type: ignore
    """Plotly X-axis options."""

yaxis

yaxis() -> go.layout.YAxis

Plotly Y-axis options.

Source code in ragraph/plot/generic.py
@field
def yaxis(self) -> go.layout.YAxis:  # type: ignore
    """Plotly Y-axis options."""

FieldPalette

1
2
3
4
FieldPalette(
    categorical: Optional[Union[str, List[str]]] = None,
    continuous: Optional[List[str]] = None,
)

Bases: Mapping

Palettes for a field in a plot.

Argument
Source code in ragraph/plot/generic.py
def __init__(
    self,
    categorical: Optional[Union[str, List[str]]] = None,
    continuous: Optional[List[str]] = None,
):
    super().__init__(self, categorical=categorical, continuous=continuous)

categorical

categorical() -> Optional[str]

Categorical color for this field.

Source code in ragraph/plot/generic.py
@field
def categorical(self) -> Optional[str]:  # type: ignore
    """Categorical color for this field."""

continuous

continuous() -> Optional[List[str]]

Continuous (numeric) data color palette for this field.

Source code in ragraph/plot/generic.py
@field
def continuous(self) -> Optional[List[str]]:  # type: ignore
    """Continuous (numeric) data color palette for this field."""

LabelsStyle

LabelsStyle(
    fontcolor: Optional[str] = None,
    fontfamily: Optional[str] = None,
    fontsize: Optional[int] = None,
    fontaspectratio: Optional[float] = None,
    shorten=None,
    textorientation: Optional[str] = None,
    xaxis: Optional[
        Union[go.layout.XAxis, Dict[str, Any]]
    ] = None,
    yaxis: Optional[
        Union[go.layout.YAxis, Dict[str, Any]]
    ] = None,
)

Bases: Mapping

Labels plot component style mapping.

Parameters:

Name Type Description Default
fontcolor Optional[str]

Font color used for labels.

None
fontfamily Optional[str]

Font family used for labels.

None
fontsize Optional[int]

Fontsize used for labels.

None
fontaspectratio Optional[float]

Font width per fontsize ratio.

None
textorientation Optional[str]

Orientation of label text, one of "horizontal", "vertical".

None
xaxis Optional[Union[XAxis, Dict[str, Any]]]

Plotly X-axis settings.

None
yaxis Optional[Union[YAxis, Dict[str, Any]]]

Plotly Y-axis settings.

None
Source code in ragraph/plot/generic.py
def __init__(
    self,
    fontcolor: Optional[str] = None,
    fontfamily: Optional[str] = None,
    fontsize: Optional[int] = None,
    fontaspectratio: Optional[float] = None,
    shorten=None,
    textorientation: Optional[str] = None,
    xaxis: Optional[Union[go.layout.XAxis, Dict[str, Any]]] = None,
    yaxis: Optional[Union[go.layout.YAxis, Dict[str, Any]]] = None,
):
    if isinstance(xaxis, dict):
        _xaxis = deepcopy(self._defaults["xaxis"])
        for k, v in xaxis.items():
            setattr(_xaxis, k, v)
        xaxis = _xaxis

    if isinstance(yaxis, dict):
        _yaxis = deepcopy(self._defaults["yaxis"])
        for k, v in yaxis.items():
            setattr(_yaxis, k, v)
        yaxis = _yaxis

    super().__init__(
        fontcolor=fontcolor,
        fontfamily=fontfamily,
        fontsize=fontsize,
        fontaspectratio=fontaspectratio,
        shorten=shorten,
        textorientation=textorientation,
        xaxis=xaxis,
        yaxis=yaxis,
    )

fontaspectratio

fontaspectratio() -> float

Font width per fontsize ratio.

Source code in ragraph/plot/generic.py
@field
def fontaspectratio(self) -> float:  # type: ignore
    """Font width per fontsize ratio."""

fontcolor

fontcolor() -> str

Font color used for labels.

Source code in ragraph/plot/generic.py
@field
def fontcolor(self) -> str:  # type: ignore
    """Font color used for labels."""

fontfamily

fontfamily() -> str

Font family used for labels.

Source code in ragraph/plot/generic.py
@field
def fontfamily(self) -> str:  # type: ignore
    """Font family used for labels."""

fontsize

fontsize() -> int

Fontsize used for labels.

Source code in ragraph/plot/generic.py
@field
def fontsize(self) -> int:  # type: ignore
    """Fontsize used for labels."""

shorten

shorten() -> Union[bool, Callable[[str], str]]

Label shortening toggle or function. When set to True everything after the last dot '.' is kept.

Source code in ragraph/plot/generic.py
@field
def shorten(self) -> Union[bool, Callable[[str], str]]:  # type: ignore
    """Label shortening toggle or function. When set to `True` everything after
    the last dot '.' is kept.
    """

textorientation

textorientation() -> float

Orientation of text.

Source code in ragraph/plot/generic.py
@field
def textorientation(self) -> float:  # type: ignore
    """Orientation of text."""

xaxis

xaxis() -> go.layout.XAxis

Plotly X-axis settings.

Source code in ragraph/plot/generic.py
@field
def xaxis(self) -> go.layout.XAxis:  # type: ignore
    """Plotly X-axis settings."""

yaxis

yaxis() -> go.layout.YAxis

Plotly Y-axis settings.

Source code in ragraph/plot/generic.py
@field
def yaxis(self) -> go.layout.YAxis:  # type: ignore
    """Plotly Y-axis settings."""

LegendStyle

LegendStyle(
    fontcolor: Optional[str] = None,
    fontfamily: Optional[str] = None,
    fontsize: Optional[int] = None,
    fontaspectratio: Optional[float] = None,
    height: Optional[int] = None,
    n_ticks: Optional[int] = None,
    xaxis: Optional[
        Union[go.layout.XAxis, Dict[str, Any]]
    ] = None,
    yaxis: Optional[
        Union[go.layout.YAxis, Dict[str, Any]]
    ] = None,
)

Bases: Mapping

Legend plot component style mapping.

Parameters:

Name Type Description Default
fontcolor Optional[str]

Font color used for labels.

None
fontfamily Optional[str]

Font family used for labels.

None
fontsize Optional[int]

Fontsize used for labels.

None
fontaspectratio Optional[float]

Font width per fontsize ratio.

None
height Optional[int]

Height of the swatch plot in number of box sizes when plotting a numerical legend.

None
n_ticks Optional[int]

Number of ticks in the swatch plot when plotting a numerical legend.

None
xaxis Optional[Union[XAxis, Dict[str, Any]]]

Plotly X-axis settings.

None
yaxis Optional[Union[YAxis, Dict[str, Any]]]

Plotly Y-axis settings.

None
Source code in ragraph/plot/generic.py
def __init__(
    self,
    fontcolor: Optional[str] = None,
    fontfamily: Optional[str] = None,
    fontsize: Optional[int] = None,
    fontaspectratio: Optional[float] = None,
    height: Optional[int] = None,
    n_ticks: Optional[int] = None,
    xaxis: Optional[Union[go.layout.XAxis, Dict[str, Any]]] = None,
    yaxis: Optional[Union[go.layout.YAxis, Dict[str, Any]]] = None,
):
    if isinstance(xaxis, dict):
        _xaxis = deepcopy(self._defaults["xaxis"])
        for k, v in xaxis.items():
            setattr(_xaxis, k, v)
        xaxis = _xaxis

    if isinstance(yaxis, dict):
        _yaxis = deepcopy(self._defaults["yaxis"])
        for k, v in yaxis.items():
            setattr(_yaxis, k, v)
        yaxis = _yaxis

    super().__init__(
        fontcolor=fontcolor,
        fontfamily=fontfamily,
        fontsize=fontsize,
        fontaspectratio=fontaspectratio,
        height=height,
        n_ticks=n_ticks,
        xaxis=xaxis,
        yaxis=yaxis,
    )

fontaspectratio

fontaspectratio() -> float

Font width per fontsize ratio.

Source code in ragraph/plot/generic.py
@field
def fontaspectratio(self) -> float:  # type: ignore
    """Font width per fontsize ratio."""

fontcolor

fontcolor() -> str

Font color used for labels.

Source code in ragraph/plot/generic.py
@field
def fontcolor(self) -> str:  # type: ignore
    """Font color used for labels."""

fontfamily

fontfamily() -> str

Font family used for labels.

Source code in ragraph/plot/generic.py
@field
def fontfamily(self) -> str:  # type: ignore
    """Font family used for labels."""

fontsize

fontsize() -> int

Fontsize used for labels.

Source code in ragraph/plot/generic.py
@field
def fontsize(self) -> int:  # type: ignore
    """Fontsize used for labels."""

height

height() -> int

Height of the swatch plot in number of box sizes when plotting a numerical legend.

Source code in ragraph/plot/generic.py
@field
def height(self) -> int:  # type: ignore
    """Height of the swatch plot in number of box sizes when plotting a
    numerical legend."""

n_ticks

n_ticks() -> int

Number of ticks in the swatch plot when plotting a numerical legend.

Source code in ragraph/plot/generic.py
@field
def n_ticks(self) -> int:  # type: ignore
    """Number of ticks in the swatch plot when plotting a numerical legend."""

xaxis

xaxis() -> go.layout.XAxis

Plotly X-axis settings.

Source code in ragraph/plot/generic.py
@field
def xaxis(self) -> go.layout.XAxis:  # type: ignore
    """Plotly X-axis settings."""

yaxis

yaxis() -> go.layout.YAxis

Plotly Y-axis settings.

Source code in ragraph/plot/generic.py
@field
def yaxis(self) -> go.layout.YAxis:  # type: ignore
    """Plotly Y-axis settings."""

Palettes

1
2
3
4
5
6
7
8
Palettes(
    categorical: Optional[List[str]] = None,
    continuous: Optional[List[str]] = None,
    fields: Optional[Dict[str, FieldPalette]] = None,
    domains: Optional[
        Dict[str, Tuple[float, float]]
    ] = None,
)

Bases: Mapping

Plot palettes mapping.

Parameters:

Name Type Description Default
categorical Optional[List[str]]

Categorical data color palette.

None
continuous Optional[List[str]]

Continuous (numeric) data color palette.

None
fields Optional[Dict[str, FieldPalette]]

Palette override dictionary per display field.

None
domains Optional[Dict[str, Tuple[float, float]]]

Value domains to interpolate palettes between per field as a tuple of (lower, upper) bounds. Only used for continuous fields.

None
Source code in ragraph/plot/generic.py
def __init__(
    self,
    categorical: Optional[List[str]] = None,
    continuous: Optional[List[str]] = None,
    fields: Optional[Dict[str, FieldPalette]] = None,
    domains: Optional[Dict[str, Tuple[float, float]]] = None,
):
    super().__init__(
        categorical=categorical,
        continuous=continuous,
        fields=fields,
        domains=domains,
    )

categorical

categorical() -> List[str]

Categorical data color palette.

Source code in ragraph/plot/generic.py
@field
def categorical(self) -> List[str]:  # type: ignore
    """Categorical data color palette."""

continuous

continuous() -> List[str]

Continuous (numeric) data color palette.

Source code in ragraph/plot/generic.py
@field
def continuous(self) -> List[str]:  # type: ignore
    """Continuous (numeric) data color palette."""

domains

domains() -> Dict[str, Tuple[float, float]]

Value domains to interpolate palettes between per field as a tuple of (lower, upper), bounds. Only used for continuous fields.

Source code in ragraph/plot/generic.py
@field
def domains(self) -> Dict[str, Tuple[float, float]]:  # type: ignore
    """Value domains to interpolate palettes between per field as a tuple of
    (lower, upper), bounds. Only used for continuous fields.
    """

fields

fields() -> Dict[str, Union[str, List[str], FieldPalette]]

Palette override dictionary per display field.

Source code in ragraph/plot/generic.py
@field
def fields(self) -> Dict[str, Union[str, List[str], FieldPalette]]:  # type: ignore
    """Palette override dictionary per display field."""

get_categorical_color

1
2
3
get_categorical_color(
    idx: int, field: Optional[str] = None
) -> str

Get a color from a categorical palette.

Source code in ragraph/plot/generic.py
def get_categorical_color(self, idx: int, field: Optional[str] = None) -> str:
    """Get a color from a categorical palette."""
    palette = self.get_categorical_palette(field=field)

    if isinstance(palette, str):
        return palette
    else:
        return palette[idx]

get_categorical_palette

1
2
3
get_categorical_palette(
    field: Optional[str] = None,
) -> Union[str, List[str]]

Get a categorical color (palette). Might be an overridden color, colorlist, or the default palette for the given field.

Source code in ragraph/plot/generic.py
def get_categorical_palette(self, field: Optional[str] = None) -> Union[str, List[str]]:
    """Get a categorical color (palette). Might be an overridden color, colorlist,
    or the default palette for the given field."""
    palette = self.fields.get(field, self.categorical)

    # Handle when it's a dictionary/FieldPalette override.
    if isinstance(palette, dict) or isinstance(palette, FieldPalette):
        palette = palette.get("categorical", self.categorical)

    # Failsafe backup.
    if palette is None:
        palette = self.categorical

    return palette

get_continuous_color

1
2
3
4
5
6
get_continuous_color(
    value: float,
    lower: float,
    upper: float,
    field: Optional[str] = None,
) -> str

Get a color from the continuous palette by its interpolated index.

Parameters:

Name Type Description Default
value float

Value to get an interpolated color for.

required
lower float

Lower bound value (overridden if selected field is in domains).

required
upper float

Upper bound value (overridden if selected field is in domains).

required
field Optional[str]

Optional field to fetch the palette for.

None
Source code in ragraph/plot/generic.py
def get_continuous_color(
    self,
    value: float,
    lower: float,
    upper: float,
    field: Optional[str] = None,
) -> str:
    """Get a color from the continuous palette by its interpolated index.

    Arguments:
        value: Value to get an interpolated color for.
        lower: Lower bound value (overridden if selected field is in domains).
        upper: Upper bound value (overridden if selected field is in domains).
        field: Optional field to fetch the palette for.
    """
    palette = self.get_continuous_palette(field=field)

    # Override lower and upper if domains are set.
    if field in self.domains:
        lower, upper = self.domains[field]

    # No scale, return highest.
    if lower == upper:
        return palette[-1]

    step = (upper - lower) / (len(palette) - 1)
    idx = int((value - lower) // step)

    idx = min(max(idx, 0), len(palette) - 1)
    return palette[idx]

get_continuous_palette

1
2
3
get_continuous_palette(
    field: Optional[str] = None,
) -> List[str]

Get a continuous color palette.

Source code in ragraph/plot/generic.py
def get_continuous_palette(self, field: Optional[str] = None) -> List[str]:
    """Get a continuous color palette."""
    palette = self.fields.get(field, self.continuous)

    # Handle when it's a dictionary/FieldPalette override.
    if isinstance(palette, dict) or isinstance(palette, FieldPalette):
        palette = palette.get("continuous", self.continuous)

    # Failsafe backup.
    return self.continuous if palette is None else palette

PieMapStyle

PieMapStyle(
    busarea: Optional[svg.SVG] = None,
    clusterline: Optional[svg.Line] = None,
    display: Optional[str] = None,
    fields: Optional[List[str]] = None,
    gridline: Optional[svg.Line] = None,
    highlight_col_annotation: Optional[str] = None,
    highlight_col_color: Optional[str] = None,
    highlight_row_annotation: Optional[str] = None,
    highlight_row_color: Optional[str] = None,
    inherit: Optional[bool] = None,
    kindline: Optional[svg.Line] = None,
    mode: Optional[str] = None,
    radius: Optional[float] = None,
    scale_weight: Optional[str] = None,
    customhoverkeys: Optional[List[str]] = None,
    xaxis: Optional[Dict[str, Any]] = None,
    yaxis: Optional[Dict[str, Any]] = None,
)

Bases: Mapping

Piechart map's plot component style mapping.

Parameters:

Name Type Description Default
busarea Optional[SVG]

Bus area SVG mapping. Used for styling the bus area.

None
display Optional[str]

What to display. One of 'kinds', 'labels', 'weight labels', 'weights'.

None
fields Optional[List[str]]

The fields to plot (the selection of kinds, labels, or weights). Leave set to None to display all the available fields automatically.

None
gridline Optional[Line]

Grid line options mapping.

None
highlight_col_annotation Optional[str]

Annotation that signals what columns should be highlighted. Value should be True-ish.

None
highlight_col_color Optional[str]

Default color to use for column highlights.

None
highlight_row_annotation Optional[str]

Annotation that signals what rows should be highlighted. Value should be True-ish.

None
highlight_row_color Optional[str]

Default color to use for row highlights.

None
inherit Optional[bool]

Whether to display edges between descendants of the axis nodes.

None
kindline Optional[Line]

Node kind separation lines options mapping.

None
mode Optional[str]

How to divide the pie-charts per category: 'equal' or 'relative'. 'equal' divides the piechart evenly. 'relative' divides the piechart according to category value.

None
radius Optional[float]

The piechart radius between 0.0 and 0.5.

None
scale_weight Optional[str]

Edge weight label that should contain values between 0.0 and 1.0 to scale the radius with.

None
customhoverkeys Optional[List[str]]

List of keys for information to be displayed on hover.

None
xaxis Optional[Dict[str, Any]]

Plotly X-axis settings.

None
yaxis Optional[Dict[str, Any]]

Plotly Y-axis settings.

None
Note

The display argument determines what is going to be plotted as piecharts in the plot area. The fields argument is a filter on the possible values for that display mode. The mode argument then tunes how the wedges that make up the piecharts should be distributed. Most of the time, 'equal' gives the most predictable and clear results.

Source code in ragraph/plot/generic.py
def __init__(
    self,
    busarea: Optional[svg.SVG] = None,
    clusterline: Optional[svg.Line] = None,
    display: Optional[str] = None,
    fields: Optional[List[str]] = None,
    gridline: Optional[svg.Line] = None,
    highlight_col_annotation: Optional[str] = None,
    highlight_col_color: Optional[str] = None,
    highlight_row_annotation: Optional[str] = None,
    highlight_row_color: Optional[str] = None,
    inherit: Optional[bool] = None,
    kindline: Optional[svg.Line] = None,
    mode: Optional[str] = None,
    radius: Optional[float] = None,
    scale_weight: Optional[str] = None,
    customhoverkeys: Optional[List[str]] = None,
    xaxis: Optional[Dict[str, Any]] = None,
    yaxis: Optional[Dict[str, Any]] = None,
):
    if isinstance(xaxis, dict):
        _xaxis = deepcopy(self._defaults["xaxis"])
        for k, v in xaxis.items():
            setattr(_xaxis, k, v)
        xaxis = _xaxis

    if isinstance(yaxis, dict):
        _yaxis = deepcopy(self._defaults["yaxis"])
        for k, v in yaxis.items():
            setattr(_yaxis, k, v)
        yaxis = _yaxis

    super().__init__(
        busarea=busarea,
        clusterline=clusterline,
        display=display,
        fields=fields,
        gridline=gridline,
        highlight_col_annotation=highlight_col_annotation,
        highlight_col_color=highlight_col_color,
        highlight_row_annotation=highlight_row_annotation,
        highlight_row_color=highlight_row_color,
        inherit=inherit,
        kindline=kindline,
        mode=mode,
        radius=radius,
        scale_weight=scale_weight,
        customhoverkeys=customhoverkeys,
        xaxis=xaxis,
        yaxis=yaxis,
    )

busarea

busarea() -> svg.SVG

Bus area SVG mapping. Used for styling the bus area.

Source code in ragraph/plot/generic.py
@field
def busarea(self) -> svg.SVG:  # type: ignore
    """Bus area SVG mapping. Used for styling the bus area."""

customhoverkeys

customhoverkeys() -> List[str]

Custom keys for information to be displayed on hover.

Source code in ragraph/plot/generic.py
@field
def customhoverkeys(self) -> List[str]:  # type: ignore
    """Custom keys for information to be displayed on hover."""

display

display() -> str

What to display. One of 'kinds', 'labels', 'weight labels', 'weights'.

Source code in ragraph/plot/generic.py
@field
def display(self) -> str:  # type: ignore
    """What to display. One of 'kinds', 'labels', 'weight labels', 'weights'."""

fields

fields() -> List[str]

The fields to plot (the selection of kinds, labels, or weights). Leave set to None to display all the available fields automatically.

Source code in ragraph/plot/generic.py
@field
def fields(self) -> List[str]:  # type: ignore
    """The fields to plot (the selection of kinds, labels, or weights). Leave set
    to `None` to display all the available fields automatically.
    """

gridline

gridline() -> svg.Line

Grid line style.

Source code in ragraph/plot/generic.py
@field
def gridline(self) -> svg.Line:  # type: ignore
    """Grid line style."""

highlight_col_annotation

highlight_col_annotation() -> Optional[str]

Annotation that signals what columns should be highlighted. Value should be True-ish.

Source code in ragraph/plot/generic.py
@field
def highlight_col_annotation(self) -> Optional[str]:  # type: ignore
    """Annotation that signals what columns should be highlighted.
    Value should be True-ish.
    """

highlight_col_color

highlight_col_color() -> Optional[str]

Default color to use for column highlights.

Source code in ragraph/plot/generic.py
@field
def highlight_col_color(self) -> Optional[str]:  # type: ignore
    """Default color to use for column highlights."""

highlight_row_annotation

highlight_row_annotation() -> Optional[str]

Annotation that signals what rows should be highlighted. Value should be True-ish.

Source code in ragraph/plot/generic.py
@field
def highlight_row_annotation(self) -> Optional[str]:  # type: ignore
    """Annotation that signals what rows should be highlighted.
    Value should be True-ish.
    """

highlight_row_color

highlight_row_color() -> Optional[str]

Default color to use for row highlights.

Source code in ragraph/plot/generic.py
@field
def highlight_row_color(self) -> Optional[str]:  # type: ignore
    """Default color to use for row highlights."""

inherit

inherit() -> bool

Whether to display edges between descendants of the axis nodes.

Source code in ragraph/plot/generic.py
@field
def inherit(self) -> bool:  # type: ignore
    """Whether to display edges between descendants of the axis nodes."""

kindline

kindline() -> svg.Line

Node kind separation lines options mapping.

Source code in ragraph/plot/generic.py
@field
def kindline(self) -> svg.Line:  # type: ignore
    """Node kind separation lines options mapping."""

mode

mode() -> str

How to divide the piecharts per field. Either 'equal' or 'relative'. 'equal' divides the piecharts evenly. 'relative' divides the piechart according to field value.

Source code in ragraph/plot/generic.py
@field
def mode(self) -> str:  # type: ignore
    """How to divide the piecharts per field. Either 'equal' or 'relative'.
    'equal' divides the piecharts evenly.
    'relative' divides the piechart according to field value.
    """

radius

radius() -> float

The piechart radius between 0.0 and 0.5.

Source code in ragraph/plot/generic.py
@field
def radius(self) -> float:  # type: ignore
    """The piechart radius between 0.0 and 0.5."""

scale_weight

scale_weight() -> str

Edge weight label that should contain values between 0.0 and 1.0 to scale the radius with.

Source code in ragraph/plot/generic.py
@field
def scale_weight(self) -> str:  # type: ignore
    """Edge weight label that should contain values between 0.0 and 1.0 to scale the
    radius with.
    """

xaxis

xaxis() -> go.layout.XAxis

Plotly X-axis settings.

Source code in ragraph/plot/generic.py
@field
def xaxis(self) -> go.layout.XAxis:  # type: ignore
    """Plotly X-axis settings."""

yaxis

yaxis() -> go.layout.YAxis

Plotly Y-axis settings.

Source code in ragraph/plot/generic.py
@field
def yaxis(self) -> go.layout.YAxis:  # type: ignore
    """Plotly Y-axis settings."""

Style

Style(
    boxsize: Optional[int] = None,
    config: Optional[Dict[str, Any]] = None,
    highlight_annotation: Optional[str] = None,
    highlight_color: Optional[str] = None,
    labels: Optional[
        Union[LabelsStyle, Dict[str, Any]]
    ] = None,
    layout: Optional[
        Union[go.Layout, Dict[str, Any]]
    ] = None,
    palettes: Optional[Palettes] = None,
    piemap: Optional[
        Union[PieMapStyle, Dict[str, Any]]
    ] = None,
    tree: Optional[Union[TreeStyle, Dict[str, Any]]] = None,
    legend: Optional[
        Union[LegendStyle, Dict[str, Any]]
    ] = None,
    show_legend: Optional[bool] = None,
    row_col_numbers: Optional[bool] = None,
    xstep: Optional[str] = None,
    ystep: Optional[str] = None,
)

Bases: Mapping

RaGraph plot style mapping.

Parameters:

Name Type Description Default
boxsize Optional[int]

Size in pixels per row or column.

None
config Optional[Dict[str, Any]]

Plotly Figure.show() config.

None
highlight_annotation Optional[str]

Annotation key of instances that should be highlighted. Value should be True-ish. Set key to None to disable.

None
highlight_color Optional[str]

Default color to use for highlights.

None
labels Optional[Union[LabelsStyle, Dict[str, Any]]]

Labels plot style.

None
layout Optional[Union[Layout, Dict[str, Any]]]

Layout options.

None
palettes Optional[Palettes]

Plot palettes options.

None
piemap Optional[Union[PieMapStyle, Dict[str, Any]]]

Piechart map plot style.

None
tree Optional[Union[TreeStyle, Dict[str, Any]]]

Tree plot style.

None
legend Optional[Union[LegendStyle, Dict[str, Any]]]

Legend plot style.

None
show_legend Optional[bool]

Bool to display legend.

None
row_col_numbers Optional[bool]

Bool to display row and column numbers.

None
xstep Optional[str]

Axis increment per row or column in plots (usually 1).

None
ystep Optional[str]

Axis increment per row or column in plots (usually 1).

None
Source code in ragraph/plot/generic.py
def __init__(
    self,
    boxsize: Optional[int] = None,
    config: Optional[Dict[str, Any]] = None,
    highlight_annotation: Optional[str] = None,
    highlight_color: Optional[str] = None,
    labels: Optional[Union[LabelsStyle, Dict[str, Any]]] = None,
    layout: Optional[Union[go.Layout, Dict[str, Any]]] = None,
    palettes: Optional[Palettes] = None,
    piemap: Optional[Union[PieMapStyle, Dict[str, Any]]] = None,
    tree: Optional[Union[TreeStyle, Dict[str, Any]]] = None,
    legend: Optional[Union[LegendStyle, Dict[str, Any]]] = None,
    show_legend: Optional[bool] = None,
    row_col_numbers: Optional[bool] = None,
    xstep: Optional[str] = None,
    ystep: Optional[str] = None,
):
    super().__init__(
        boxsize=boxsize,
        config=config,
        highlight_annotation=highlight_annotation,
        highlight_color=highlight_color,
        labels=labels,
        layout=layout,
        palettes=palettes,
        piemap=piemap,
        tree=tree,
        legend=legend,
        show_legend=show_legend,
        row_col_numbers=row_col_numbers,
        xstep=xstep,
        ystep=ystep,
    )

boxsize

boxsize() -> int

Size in pixels per row or column.

Source code in ragraph/plot/generic.py
@field
def boxsize(self) -> int:  # type: ignore
    """Size in pixels per row or column."""

config

config() -> Dict[str, Any]

Plotly Figure.show() config.

Source code in ragraph/plot/generic.py
@field
def config(self) -> Dict[str, Any]:  # type: ignore
    """Plotly Figure.show() config."""

highlight_annotation

highlight_annotation() -> Optional[str]

Annotation key of instances that should be highlighted. Value should be True-ish. Set key to None to disable.

Source code in ragraph/plot/generic.py
@field
def highlight_annotation(self) -> Optional[str]:  # type: ignore
    """Annotation key of instances that should be highlighted.
    Value should be True-ish. Set key to `None` to disable."""

highlight_color

highlight_color() -> str

Default color to use for highlights.

Source code in ragraph/plot/generic.py
@field
def highlight_color(self) -> str:  # type: ignore
    """Default color to use for highlights."""

labels

labels() -> LabelsStyle

Labels plot style.

Source code in ragraph/plot/generic.py
@field
def labels(self) -> LabelsStyle:  # type: ignore
    """Labels plot style."""

layout

layout() -> go.Layout

Layout options.

Source code in ragraph/plot/generic.py
@field
def layout(self) -> go.Layout:  # type: ignore
    """Layout options."""

legend

legend() -> LegendStyle

Legend plot style.

Source code in ragraph/plot/generic.py
@field
def legend(self) -> LegendStyle:  # type: ignore
    """Legend plot style."""

palettes

palettes() -> Palettes

Plot palettes options.

Source code in ragraph/plot/generic.py
@field
def palettes(self) -> Palettes:  # type: ignore
    """Plot palettes options."""

piemap

piemap() -> PieMapStyle

Piechart map plot style.

Source code in ragraph/plot/generic.py
@field
def piemap(self) -> PieMapStyle:  # type: ignore
    """Piechart map plot style."""

row_col_numbers

row_col_numbers() -> bool

Boolean to display row and column numbers.

Source code in ragraph/plot/generic.py
@field
def row_col_numbers(self) -> bool:  # type: ignore
    """Boolean to display row and column numbers."""

show_legend

show_legend() -> bool

Boolean to display a legend.

Source code in ragraph/plot/generic.py
@field
def show_legend(self) -> bool:  # type: ignore
    """Boolean to display a legend."""

tree

tree() -> TreeStyle

Tree plot style.

Source code in ragraph/plot/generic.py
@field
def tree(self) -> TreeStyle:  # type: ignore
    """Tree plot style."""

xstep

xstep() -> float

Axis increment per row or column in plots (usually 1).

Source code in ragraph/plot/generic.py
@field
def xstep(self) -> float:  # type: ignore
    """Axis increment per row or column in plots (usually 1)."""

ystep

ystep() -> float

Axis increment per row or column in plots (usually 1).

Source code in ragraph/plot/generic.py
@field
def ystep(self) -> float:  # type: ignore
    """Axis increment per row or column in plots (usually 1)."""

TreeStyle

1
2
3
4
5
6
7
8
9
TreeStyle(
    line: Optional[Union[svg.Line, Dict[str, Any]]] = None,
    xaxis: Optional[
        Union[go.layout.XAxis, Dict[str, Any]]
    ] = None,
    yaxis: Optional[
        Union[go.layout.YAxis, Dict[str, Any]]
    ] = None,
)

Bases: Mapping

RaGraph tree plot component style mapping.

Parameters:

Name Type Description Default
line Optional[Union[Line, Dict[str, Any]]]

Line style mapping for hierarchy tree lines.

None
xaxis Optional[Union[XAxis, Dict[str, Any]]]

Plotly X-axis settings.

None
yaxis Optional[Union[YAxis, Dict[str, Any]]]

Plotly Y-axis settings.

None
Source code in ragraph/plot/generic.py
def __init__(
    self,
    line: Optional[Union[svg.Line, Dict[str, Any]]] = None,
    xaxis: Optional[Union[go.layout.XAxis, Dict[str, Any]]] = None,
    yaxis: Optional[Union[go.layout.YAxis, Dict[str, Any]]] = None,
):
    if isinstance(xaxis, dict):
        _xaxis = deepcopy(self._defaults["xaxis"])
        for k, v in xaxis.items():
            setattr(_xaxis, k, v)
        xaxis = _xaxis

    if isinstance(yaxis, dict):
        _yaxis = deepcopy(self._defaults["yaxis"])
        for k, v in yaxis.items():
            setattr(_yaxis, k, v)
        yaxis = _yaxis

    super().__init__(line=line, xaxis=xaxis, yaxis=yaxis)

line

line() -> svg.Line

Line style mapping for hierarchy tree lines.

Source code in ragraph/plot/generic.py
@field
def line(self) -> svg.Line:  # type: ignore
    """Line style mapping for hierarchy tree lines."""

xaxis

xaxis() -> go.layout.XAxis

Plotly X-axis settings.

Source code in ragraph/plot/generic.py
@field
def xaxis(self) -> go.layout.XAxis:  # type: ignore
    """Plotly X-axis settings."""

yaxis

yaxis() -> go.layout.YAxis

Plotly Y-axis settings.

Source code in ragraph/plot/generic.py
@field
def yaxis(self) -> go.layout.YAxis:  # type: ignore
    """Plotly Y-axis settings."""