# evidently.renderers

## Submodules

## base\_renderer module <a href="#module-evidently.renderers.base_renderer" id="module-evidently.renderers.base_renderer"></a>

### class BaseRenderer(color\_options: Optional\[[ColorOptions](https://francesco.gitbook.io/docs.evidentlyai.com/reference/evidently.options#evidently.options.color_scheme.ColorOptions)] = None)

Bases: `object`

Base class for all renderers

#### Attributes:

&#x20;    **color\_options :** [**ColorOptions**](https://francesco.gitbook.io/docs.evidentlyai.com/reference/evidently.options#evidently.options.color_scheme.ColorOptions)

### class DetailsInfo(title: str, info: evidently.model.widget.BaseWidgetInfo, id: str = )

Bases: `object`

#### Attributes:

&#x20;    **id : str**

&#x20;    **info : BaseWidgetInfo**

&#x20;    **title : str**

### class MetricRenderer(color\_options: Optional\[[ColorOptions](https://francesco.gitbook.io/docs.evidentlyai.com/reference/evidently.options#evidently.options.color_scheme.ColorOptions)] = None)

Bases: `BaseRenderer`

#### Attributes:

&#x20;    **color\_options :** [**ColorOptions**](https://francesco.gitbook.io/docs.evidentlyai.com/reference/evidently.options#evidently.options.color_scheme.ColorOptions)

#### Methods:

&#x20;    **render\_html(obj)**

&#x20;    **render\_json(obj)**

### class RenderersDefinitions(typed\_renderers: dict = , default\_html\_test\_renderer: Optional\[evidently.renderers.base\_renderer.TestRenderer] = None, default\_html\_metric\_renderer: Optional\[evidently.renderers.base\_renderer.MetricRenderer] = None)

Bases: `object`

#### Attributes:

&#x20;    **default\_html\_metric\_renderer : Optional\[MetricRenderer] = None**

&#x20;    **default\_html\_test\_renderer : Optional\[TestRenderer] = None**

&#x20;    **typed\_renderers : dict**

### class TestHtmlInfo(name: str, description: str, status: str, details: List\[DetailsInfo], groups: Dict\[str, str])

Bases: `object`

#### Attributes:

&#x20;    **description : str**

&#x20;    **details : List\[DetailsInfo]**

&#x20;    **groups : Dict\[str, str]**

&#x20;    **name : str**

&#x20;    **status : str**

#### Methods:

&#x20;    **with\_details(title: str, info: BaseWidgetInfo)**

### class TestRenderer(color\_options: Optional\[[ColorOptions](https://francesco.gitbook.io/docs.evidentlyai.com/reference/evidently.options#evidently.options.color_scheme.ColorOptions)] = None)

Bases: `BaseRenderer`

#### Attributes:

&#x20;    **color\_options :** [**ColorOptions**](https://francesco.gitbook.io/docs.evidentlyai.com/reference/evidently.options#evidently.options.color_scheme.ColorOptions)

#### Methods:

&#x20;    **html\_description(obj)**

&#x20;    **json\_description(obj)**

&#x20;    **render\_html(obj)**

&#x20;    **render\_json(obj)**

### default\_renderer(wrap\_type)

## html\_widgets module <a href="#module-evidently.renderers.html_widgets" id="module-evidently.renderers.html_widgets"></a>

### class ColumnDefinition(title: str, field\_name: str, type: evidently.renderers.html\_widgets.ColumnType = \<ColumnType.STRING: 'string'>, sort: Optional\[evidently.renderers.html\_widgets.SortDirection] = None, options: Optional\[dict] = None)

Bases: `object`

#### Attributes:

&#x20;    **field\_name : str**

&#x20;    **options : Optional\[dict] = None**

&#x20;    **sort : Optional\[SortDirection] = None**

&#x20;    **title : str**

&#x20;    **type : ColumnType = 'string'**

#### Methods:

&#x20;    **as\_dict()**

### class ColumnType(value)

Bases: `Enum`

An enumeration.

#### Attributes:

&#x20;    **HISTOGRAM = 'histogram'**

&#x20;    **LINE = 'line'**

&#x20;    **SCATTER = 'scatter'**

&#x20;    **STRING = 'string'**

### class CounterData(label: str, value: str)

Bases: `object`

#### Attributes:

&#x20;    **label : str**

&#x20;    **value : str**

#### Methods:

&#x20;    **static float(label: str, value: float, precision: int)**

create CounterData for float value with given precision.

* **Parameters**
* `label` – counter label
* `value` – float value of counter
* `precision` – decimal precision

&#x20;    **static int(label: str, value: int)**

create CounterData for int value.

* **Parameters**
* `label` – counter label
* `value` – int value

&#x20;    **static string(label: str, value: str)**

create CounterData for string value with given precision.

* **Parameters**
* `label` – counter label
* `value` – string value of counter

### class DetailsPartInfo(title: str, info: Union\[BaseWidgetInfo, PlotlyGraphInfo])

Bases: `object`

#### Attributes:

&#x20;    **info : Union\[BaseWidgetInfo, PlotlyGraphInfo]**

&#x20;    **title : str**

### class GraphData(title: str, data: dict, layout: dict)

Bases: `object`

#### Attributes:

&#x20;    **data : dict**

&#x20;    **layout : dict**

&#x20;    **title : str**

#### Methods:

&#x20;    **static figure(title: str, figure: Figure)**

create GraphData from plotly figure itself :param title: title of graph :param figure: plotly figure for getting data from

### class HeatmapData(name: str, matrix: pandas.core.frame.DataFrame)

Bases: `object`

#### Attributes:

&#x20;    **matrix : DataFrame**

&#x20;    **name : str**

### class HistogramData(name: str, x: list, y: List\[Union\[int, float]])

Bases: `object`

#### Attributes:

&#x20;    **name : str**

&#x20;    **x : list**

&#x20;    **y : List\[Union\[int, float]]**

### class RichTableDataRow(fields: dict, details: Optional\[RowDetails] = None)

Bases: `object`

#### Attributes:

&#x20;    **details : Optional\[RowDetails]**

&#x20;    **fields : dict**

### class RowDetails(parts: Optional\[List\[DetailsPartInfo]] = None)

Bases: `object`

#### Attributes:

&#x20;    **parts : List\[DetailsPartInfo]**

#### Methods:

&#x20;    **with\_part(title: str, info: Union\[BaseWidgetInfo, PlotlyGraphInfo])**

### class SortDirection(value)

Bases: `Enum`

An enumeration.

#### Attributes:

&#x20;    **ASC = 'asc'**

&#x20;    **DESC = 'desc'**

### class TabData(title: str, widget: evidently.model.widget.BaseWidgetInfo)

Bases: `object`

#### Attributes:

&#x20;    **title : str**

&#x20;    **widget : BaseWidgetInfo**

### class WidgetSize(value)

Bases: `Enum`

An enumeration.

#### Attributes:

&#x20;    **FULL = 2**

&#x20;    **HALF = 1**

### counter(\*, counters: List\[CounterData], title: str = '', size: WidgetSize = WidgetSize.FULL)

generate widget with given counters

* **Parameters**
  * `title` – widget title
  * `counters` – list of counters in widget
  * `size` – widget size

### Example

```python
>>> display_counters = [CounterData("value1", "some value"), CounterData.float("float", 0.111, 2)]
>>> widget_info = counter(counters=display_counters, title="counters example")
```

### get\_class\_separation\_plot\_data(current\_plot: DataFrame, reference\_plot: Optional\[DataFrame], target\_name: str, color\_options: [ColorOptions](https://francesco.gitbook.io/docs.evidentlyai.com/reference/evidently.options#evidently.options.color_scheme.ColorOptions))

### get\_heatmaps\_widget(\*, title: str = '', primary\_data: HeatmapData, secondary\_data: Optional\[HeatmapData] = None, size: WidgetSize = WidgetSize.FULL, color\_options: [ColorOptions](https://francesco.gitbook.io/docs.evidentlyai.com/reference/evidently.options#evidently.options.color_scheme.ColorOptions))

Create a widget with heatmap(s)

### get\_histogram\_figure(\*, primary\_hist: HistogramData, secondary\_hist: Optional\[HistogramData] = None, color\_options: [ColorOptions](https://francesco.gitbook.io/docs.evidentlyai.com/reference/evidently.options#evidently.options.color_scheme.ColorOptions), orientation: str = 'v')

### get\_histogram\_figure\_with\_quantile(\*, current: HistogramData, reference: Optional\[HistogramData] = None, current\_quantile: float, reference\_quantile: Optional\[float] = None, color\_options: [ColorOptions](https://francesco.gitbook.io/docs.evidentlyai.com/reference/evidently.options#evidently.options.color_scheme.ColorOptions), orientation: str = 'v')

### get\_histogram\_figure\_with\_range(\*, primary\_hist: HistogramData, secondary\_hist: Optional\[HistogramData] = None, left: Union\[float, int], right: Union\[float, int], orientation: str = 'v', color\_options: [ColorOptions](https://francesco.gitbook.io/docs.evidentlyai.com/reference/evidently.options#evidently.options.color_scheme.ColorOptions))

### get\_histogram\_for\_distribution(\*, current\_distribution: [Distribution](https://francesco.gitbook.io/docs.evidentlyai.com/reference/evidently.utils#evidently.utils.visualizations.Distribution), reference\_distribution: Optional\[[Distribution](https://francesco.gitbook.io/docs.evidentlyai.com/reference/evidently.utils#evidently.utils.visualizations.Distribution)] = None, title: str = '', xaxis\_title: Optional\[str] = None, yaxis\_title: Optional\[str] = None, color\_options: [ColorOptions](https://francesco.gitbook.io/docs.evidentlyai.com/reference/evidently.options#evidently.options.color_scheme.ColorOptions))

### get\_pr\_rec\_plot\_data(current\_pr\_curve: dict, reference\_pr\_curve: Optional\[dict], color\_options: [ColorOptions](https://francesco.gitbook.io/docs.evidentlyai.com/reference/evidently.options#evidently.options.color_scheme.ColorOptions))

### get\_roc\_auc\_tab\_data(curr\_roc\_curve: dict, ref\_roc\_curve: Optional\[dict], color\_options: [ColorOptions](https://francesco.gitbook.io/docs.evidentlyai.com/reference/evidently.options#evidently.options.color_scheme.ColorOptions))

### header\_text(\*, label: str, title: str = '', size: WidgetSize = WidgetSize.FULL)

generate widget with some text as header

* **Parameters**
  * `label` – text to display
  * `title` – widget title
  * `size` – widget size

### histogram(\*, title: str, primary\_hist: HistogramData, secondary\_hist: Optional\[HistogramData] = None, color\_options: [ColorOptions](https://francesco.gitbook.io/docs.evidentlyai.com/reference/evidently.options#evidently.options.color_scheme.ColorOptions), orientation: str = 'v', size: WidgetSize = WidgetSize.FULL, xaxis\_title: Optional\[str] = None, yaxis\_title: Optional\[str] = None)

generate widget with one or two histogram

* **Parameters**
  * `title` – widget title
  * `primary_hist` – first histogram to show in widget
  * `secondary_hist` – optional second histogram to show in widget
  * `orientation` – bars orientation in histograms
  * `color_options` – color options to use for widgets
  * `size` – widget size
  * `xaxis_title` – title for x-axis
  * `yaxis_title` – title for y-axis

### Example

```python
>>> ref_hist = HistogramData("Histogram 1", x=["a", "b", "c"], y=[1, 2, 3])
>>> curr_hist = HistogramData("Histogram 2", x=["a", "b", "c"], y=[3, 2 ,1])
>>> widget_info = histogram(
>>>     title="Histogram example",
>>>     primary_hist=ref_hist,
>>>     secondary_hist=curr_hist,
>>>     color_options=color_options
>>> )
```

### plotly\_data(\*, title: str, data: dict, layout: dict, size: WidgetSize = WidgetSize.FULL)

generate plotly plot with given data and layout (can be generated from plotly).

* **Parameters**
  * `title` – widget title
  * `data` – plotly figure data
  * `layout` – plotly figure layout
  * `size` – widget size

### Example

```python
>>> figure = go.Figure(go.Bar(name="Bar plot", x=[1, 2, 3, 4], y=[10, 11, 20, 11]))
>>> f_dict = figure.to_plotly_json()
>>> widget_info = plotly_data(title="Some plot title", data=f_dict["data"], layout=f_dict["layout"])
```

### plotly\_figure(\*, title: str, figure: Figure, size: WidgetSize = WidgetSize.FULL)

generate plotly plot based on given plotly figure object.

* **Parameters**
  * `title` – title of widget
  * `figure` – plotly figure which should be rendered as widget
  * `size` – size of widget, default to WidgetSize.FULL

### Example

```python
>>> bar_figure = go.Figure(go.Bar(name="Bar plot", x=[1, 2, 3, 4], y=[10, 11, 20, 11]))
>>> widget_info = plotly_figure(title="Bar plot widget", figure=bar_figure, size=WidgetSize.FULL)
```

### plotly\_graph(\*, graph\_data: GraphData, size: WidgetSize = WidgetSize.FULL)

generate plotly plot with given GraphData object.

* **Parameters**
  * `graph_data` – plot data for widget
  * `size` – size of widget to render

### Example

```python
>>> figure = go.Figure(go.Bar(name="Bar plot", x=[1, 2, 3, 4], y=[10, 11, 20, 11]))
>>> f_dict = figure.to_plotly_json()
>>> bar_graph_data = GraphData(title="Some plot title", data=f_dict["data"], layout=f_dict["layout"])
>>> widget_info = plotly_graph(graph_data=bar_graph_data, size=WidgetSize.FULL)
```

### plotly\_graph\_tabs(\*, title: str, figures: List\[GraphData], size: WidgetSize = WidgetSize.FULL)

generate Tab widget with multiple graphs

* **Parameters**
  * `title` – widget title
  * `figures` – list of graphs with tab titles
  * `size` – widget size

### Example

```python
>>> bar_figure = go.Figure(go.Bar(name="Bar plot", x=[1, 2, 3, 4], y=[10, 11, 20, 11]))
>>> line_figure = go.Figure(go.Line(name="Bar plot", x=[1, 2, 3, 4], y=[10, 11, 20, 11]))
>>> widget_info = plotly_graph_tabs(
...     title="Tabbed widget",
...     figures=[GraphData.figure("Bar", bar_figure), GraphData.figure("Line", line_figure)],
... )
```

### rich\_table\_data(\*, title: str = '', size: WidgetSize = WidgetSize.FULL, rows\_per\_page: int = 10, columns: List\[ColumnDefinition], data: List\[RichTableDataRow])

generate widget with rich table: with additional column types and details for rows

* **Parameters**
  * `title` – widget title
  * `size` – widget size
  * `rows_per_page` – maximum number per page to show
  * `columns` – list of columns in table
  * `data` – list of dicts with data (key-value pairs, keys is according to ColumnDefinition.field\_name)

### Example

```python
>>> columns_def = [
...     ColumnDefinition("Column A", "field_1"),
...     ColumnDefinition("Column B", "field_2", ColumnType.HISTOGRAM,
...                      options={"xField": "x", "yField": "y", "color": "#ed0400"}),
...     ColumnDefinition("Column C", "field_3", sort=SortDirection.ASC),
... ]
>>> in_table_data = [
...     RichTableDataRow(fields=dict(field_1="a", field_2=dict(x=[1, 2, 3], y=[10, 11, 3]), field_3="2")),
...     RichTableDataRow(
...         fields=dict(field_1="b", field_2=dict(x=[1, 2, 3], y=[10, 11, 3]), field_3="1"),
...         details=RowDetails()
...             .with_part("Some details", counter(counters=[CounterData("counter 1", "value")])
...         )
...     )
... ]
>>> widget_info = rich_table_data(title="Rich table", rows_per_page=10, columns=columns_def, data=in_table_data)
```

### table\_data(\*, column\_names: Iterable\[str], data: Iterable\[Iterable], title: str = '', size: WidgetSize = WidgetSize.FULL)

generate simple table with given columns and data

* **Parameters**
  * `column_names` – list of column names in display order
  * `data` – list of data rows (lists of object to show in table in order of columns), object will be converted to str
  * `title` – widget title
  * `size` – widget size

### Example

```python
>>> columns = ["Column A", "Column B"]
>>> in_table_data = [[1, 2], [3, 4]]
>>> widget_info = table_data(column_names=columns, data=in_table_data, title="Table")
```

### widget\_tabs(\*, title: str = '', size: WidgetSize = WidgetSize.FULL, tabs: List\[TabData])

generate widget with tabs which can contain any other widget.

* **Parameters**
  * `title` – widget title
  * `size` – widget size
  * `tabs` – list of TabData with widgets to include

### Example

```python
>>> columns = ["Column A", "Column B"]
>>> in_table_data = [[1, 2], [3, 4]]
>>> tab_data = [
...     TabData("Counters", counter(counters=[CounterData("counter", "value")], title="Counter")),
...     TabData("Table", table_data(column_names=columns, data=in_table_data, title="Table")),
... ]
>>> widget_info = widget_tabs(title="Tabs", tabs=tab_data)
```

### widget\_tabs\_for\_more\_than\_one(\*, title: str = '', size: WidgetSize = WidgetSize.FULL, tabs: List\[TabData])

Draw tabs widget only if there is more than one tab, otherwise just draw one widget

## notebook\_utils module <a href="#module-evidently.renderers.notebook_utils" id="module-evidently.renderers.notebook_utils"></a>

### determine\_template(mode: str)

## render\_utils module <a href="#module-evidently.renderers.render_utils" id="module-evidently.renderers.render_utils"></a>

### get\_distribution\_plot\_figure(\*, current\_distribution: [Distribution](https://francesco.gitbook.io/docs.evidentlyai.com/reference/evidently.utils#evidently.utils.visualizations.Distribution), reference\_distribution: Optional\[[Distribution](https://francesco.gitbook.io/docs.evidentlyai.com/reference/evidently.utils#evidently.utils.visualizations.Distribution)], color\_options: [ColorOptions](https://francesco.gitbook.io/docs.evidentlyai.com/reference/evidently.options#evidently.options.color_scheme.ColorOptions), orientation: str = 'v')

### plot\_distr(\*, hist\_curr, hist\_ref=None, orientation='v', color\_options: [ColorOptions](https://francesco.gitbook.io/docs.evidentlyai.com/reference/evidently.options#evidently.options.color_scheme.ColorOptions))
