ragraph.plot.generic
#
RaGraph generic plotting classes such as Component
and Style
.
Module Contents#
Classes#
RaGraph tree plot component style mapping. |
|
Labels plot component style mapping. |
|
Piechart map's plot component style mapping. |
|
Palettes for a field in a plot. |
|
Plot palettes mapping. |
|
Legend plot component style mapping. |
|
RaGraph plot style mapping. |
|
Plot component. The basic building block to create compound Plotly figures with. |
Attributes#
- ragraph.plot.generic.MODEBAR_BUTTONS#
- class ragraph.plot.generic.TreeStyle(line: Optional[Union[ragraph.plot.svg.Line, Dict[str, Any]]] = None, xaxis: Optional[Union[plotly.graph_objs.layout.XAxis, Dict[str, Any]]] = None, yaxis: Optional[Union[plotly.graph_objs.layout.YAxis, Dict[str, Any]]] = None)#
Bases:
ragraph.generic.Mapping
RaGraph tree plot component style mapping.
- Parameters:
line – Line style mapping for hierarchy tree lines.
xaxis – Plotly X-axis settings.
yaxis – Plotly Y-axis settings.
- _defaults#
- line() ragraph.plot.svg.Line #
Line style mapping for hierarchy tree lines.
- xaxis() plotly.graph_objs.layout.XAxis #
Plotly X-axis settings.
- yaxis() plotly.graph_objs.layout.YAxis #
Plotly Y-axis settings.
- class ragraph.plot.generic.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[plotly.graph_objs.layout.XAxis, Dict[str, Any]]] = None, yaxis: Optional[Union[plotly.graph_objs.layout.YAxis, Dict[str, Any]]] = None)#
Bases:
ragraph.generic.Mapping
Labels plot component style mapping.
- Parameters:
fontcolor – Font color used for labels.
fontfamily – Font family used for labels.
fontsize – Fontsize used for labels.
fontaspectratio – Font width per fontsize ratio.
textorientation – Orientation of label text, one of “horizontal”, “vertical”.
xaxis – Plotly X-axis settings.
yaxis – Plotly Y-axis settings.
- _defaults#
- fontcolor() str #
Font color used for labels.
- fontfamily() str #
Font family used for labels.
- fontsize() int #
Fontsize used for labels.
- fontaspectratio() float #
Font width per fontsize ratio.
- shorten() Union[bool, Callable[[str], str]] #
Label shortening toggle or function. When set to True everything after the last dot ‘.’ is kept.
- textorientation() float #
Orientation of text.
- xaxis() plotly.graph_objs.layout.XAxis #
Plotly X-axis settings.
- yaxis() plotly.graph_objs.layout.YAxis #
Plotly Y-axis settings.
- class ragraph.plot.generic.PieMapStyle(busarea: Optional[ragraph.plot.svg.SVG] = None, clusterline: Optional[ragraph.plot.svg.Line] = None, display: Optional[str] = None, fields: Optional[List[str]] = None, gridline: Optional[ragraph.plot.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[ragraph.plot.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:
ragraph.generic.Mapping
Piechart map’s plot component style mapping.
- Parameters:
busarea – Bus area SVG mapping. Used for styling the bus area.
display – What to display. One of ‘kinds’, ‘labels’, ‘weight labels’, ‘weights’.
fields – The fields to plot (the selection of kinds, labels, or weights). Leave set to None to display all the available fields automatically.
gridline – Grid line options mapping.
highlight_col_annotation – Annotation that signals what columns should be highlighted. Value should be True-ish.
highlight_col_color – Default color to use for column highlights.
highlight_row_annotation – Annotation that signals what rows should be highlighted. Value should be True-ish.
highlight_row_color – Default color to use for row highlights.
inherit – Whether to display edges between descendants of the axis nodes.
kindline – Node kind separation lines options mapping.
mode – How to divide the pie-charts per category: ‘equal’ or ‘relative’. ‘equal’ divides the piechart evenly. ‘relative’ divides the piechart according to category value.
radius – The piechart radius between 0.0 and 0.5.
scale_weight – Edge weight label that should contain values between 0.0 and 1.0 to scale the radius with.
customhoverkeys – List of keys for information to be displayed on hover.
xaxis – Plotly X-axis settings.
yaxis – Plotly Y-axis settings.
Note
The
display
argument determines what is going to be plotted as piecharts in the plot area. Thefields
argument is a filter on the possible values for that display mode. Themode
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.- _defaults#
- busarea() ragraph.plot.svg.SVG #
Bus area SVG mapping. Used for styling the bus area.
- display() str #
What to display. One of ‘kinds’, ‘labels’, ‘weight labels’, ‘weights’.
- 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.
- gridline() ragraph.plot.svg.Line #
Grid line style.
- highlight_col_annotation() Optional[str] #
Annotation that signals what columns should be highlighted. Value should be True-ish.
- highlight_col_color() Optional[str] #
Default color to use for column highlights.
- highlight_row_annotation() Optional[str] #
Annotation that signals what rows should be highlighted. Value should be True-ish.
- highlight_row_color() Optional[str] #
Default color to use for row highlights.
- inherit() bool #
Whether to display edges between descendants of the axis nodes.
- kindline() ragraph.plot.svg.Line #
Node kind separation lines options mapping.
- 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.
- radius() float #
The piechart radius between 0.0 and 0.5.
- scale_weight() str #
Edge weight label that should contain values between 0.0 and 1.0 to scale the radius with.
- customhoverkeys() List[str] #
Custom keys for information to be displayed on hover.
- xaxis() plotly.graph_objs.layout.XAxis #
Plotly X-axis settings.
- yaxis() plotly.graph_objs.layout.YAxis #
Plotly Y-axis settings.
- class ragraph.plot.generic.FieldPalette(categorical: Optional[Union[str, List[str]]] = None, continuous: Optional[List[str]] = None)#
Bases:
ragraph.generic.Mapping
Palettes for a field in a plot.
- Argument:
categorical: Categorical color for this field. continuous: Continuous (numeric) data color palette for this field.
- _defaults#
- categorical() Optional[str] #
Categorical color for this field.
- continuous() Optional[List[str]] #
Continuous (numeric) data color palette for this field.
- class ragraph.plot.generic.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:
ragraph.generic.Mapping
Plot palettes mapping.
- Parameters:
categorical – Categorical data color palette.
continuous – Continuous (numeric) data color palette.
fields – Palette override dictionary per display field.
domains – Value domains to interpolate palettes between per field as a tuple of (lower, upper) bounds. Only used for continuous fields.
- _defaults#
- 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.
- get_categorical_color(idx: int, field: Optional[str] = None) str #
Get a color from a categorical palette.
- get_continuous_palette(field: Optional[str] = None) List[str] #
Get a continuous color palette.
- 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:
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.
- categorical() List[str] #
Categorical data color palette.
- continuous() List[str] #
Continuous (numeric) data color palette.
- fields() Dict[str, Union[str, List[str], FieldPalette]] #
Palette override dictionary per display field.
- 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.
- class ragraph.plot.generic.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[plotly.graph_objs.layout.XAxis, Dict[str, Any]]] = None, yaxis: Optional[Union[plotly.graph_objs.layout.YAxis, Dict[str, Any]]] = None)#
Bases:
ragraph.generic.Mapping
Legend plot component style mapping.
- Parameters:
fontcolor – Font color used for labels.
fontfamily – Font family used for labels.
fontsize – Fontsize used for labels.
fontaspectratio – Font width per fontsize ratio.
height – Height of the swatch plot in number of box sizes when plotting a numerical legend.
n_ticks – Number of ticks in the swatch plot when plotting a numerical legend.
xaxis – Plotly X-axis settings.
yaxis – Plotly Y-axis settings.
- _defaults#
- fontcolor() str #
Font color used for labels.
- fontfamily() str #
Font family used for labels.
- fontsize() int #
Fontsize used for labels.
- fontaspectratio() float #
Font width per fontsize ratio.
- height() int #
Height of the swatch plot in number of box sizes when plotting a numerical legend.
- n_ticks() int #
Number of ticks in the swatch plot when plotting a numerical legend.
- xaxis() plotly.graph_objs.layout.XAxis #
Plotly X-axis settings.
- yaxis() plotly.graph_objs.layout.YAxis #
Plotly Y-axis settings.
- class ragraph.plot.generic.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[plotly.graph_objs.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:
ragraph.generic.Mapping
RaGraph plot style mapping.
- Parameters:
boxsize – Size in pixels per row or column.
config – Plotly Figure.show() config.
highlight_annotation – Annotation key of instances that should be highlighted. Value should be True-ish. Set key to None to disable.
highlight_color – Default color to use for highlights.
labels – Labels plot style.
layout – Layout options.
palettes – Plot palettes options.
piemap – Piechart map plot style.
tree – Tree plot style.
legend – Legend plot style.
show_legend – Bool to display legend.
row_col_numbers – Bool to display row and column numbers.
xstep – Axis increment per row or column in plots (usually 1).
ystep – Axis increment per row or column in plots (usually 1).
- _defaults#
- boxsize() int #
Size in pixels per row or column.
- config() Dict[str, Any] #
Plotly Figure.show() config.
- highlight_annotation() Optional[str] #
Annotation key of instances that should be highlighted. Value should be True-ish. Set key to None to disable.
- highlight_color() str #
Default color to use for highlights.
- labels() LabelsStyle #
Labels plot style.
- layout() plotly.graph_objs.Layout #
Layout options.
- piemap() PieMapStyle #
Piechart map plot style.
- legend() LegendStyle #
Legend plot style.
- show_legend() bool #
Boolean to display a legend.
- row_col_numbers() bool #
Boolean to display row and column numbers.
- xstep() float #
Axis increment per row or column in plots (usually 1).
- ystep() float #
Axis increment per row or column in plots (usually 1).
- class ragraph.plot.generic.Component(width: Optional[float] = None, height: Optional[float] = None, traces: Optional[List[plotly.basedatatypes.BaseTraceType]] = None, shapes: Optional[List[Dict[str, Any]]] = None, annotations: Optional[List[Dict[str, Any]]] = None, xaxis: Optional[Union[plotly.graph_objs.layout.XAxis, Dict[str, Any]]] = None, yaxis: Optional[Union[plotly.graph_objs.layout.YAxis, Dict[str, Any]]] = None)#
Bases:
ragraph.generic.Mapping
Plot component. The basic building block to create compound Plotly figures with.
- Parameters:
width – Width in pixels.
height – Height in pixels.
traces – Traces to plot in this domain.
shapes – SVG shapes from this component.
xaxis – Plotly X-axis options.
yaxis – Plotly Y-axis options.
- _defaults :Dict[str, Any]#
- width() float #
Width in pixels.
- height() float #
Height in pixels.
- traces() List[plotly.basedatatypes.BaseTraceType] #
Traces to plot in this domain.
- shapes() List[Dict[str, Any]] #
SVG shapes from this component.
- annotations() List[Dict[str, Any]] #
Annotations from this component.
- xaxis() plotly.graph_objs.layout.XAxis #
Plotly X-axis options.
- yaxis() plotly.graph_objs.layout.YAxis #
Plotly Y-axis options.