Dumbbell
simple_dumbbell(data, title='Dumbbell plot', marker_size=16, marker_line_width=8, plotly_kwargs=None, size=None, show_legend=None, show=True, write_html_path=None)
¶
Creates a dumbbell plot. These are useful to show the difference between two sets of data which have the same categories. For instance, it can be used to compare two binary classifiers by plotting the various classification metrics.
Example:
from blitzly.plots.dumbbell import simple_dumbbell
import numpy as np
import pandas as pd
data = {
"foo": np.random.randn(10),
"bar": np.random.randn(10),
}
index = [f"category_{i+1}" for i in range(10)]
df = pd.DataFrame(data, index=index)
simple_dumbbell(df)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data |
Union[pd.DataFrame, NDArray]
|
Data to plot. |
required |
title |
str
|
Title of the plot. |
'Dumbbell plot'
|
marker_size |
int
|
Size of the circular marker of the dumbbells. |
16
|
marker_line_width |
int
|
Thickness of the line joining the markers. |
8
|
plotly_kwargs |
Optional[dict]
|
Additional keyword arguments to pass to Plotly |
None
|
size |
Optional[Tuple[int, int]
|
Size of the plot. |
None
|
show_legend |
Optional[bool]
|
Whether to show the legend. |
None
|
show |
bool
|
Whether to show the figure. |
True
|
write_html_path |
Optional[str]
|
The path to which the histogram should be written as an HTML file. If None, the histogram will not be saved. |
None
|
Returns:
Name | Type | Description |
---|---|---|
BaseFigure |
BaseFigure
|
The dumbbell plot. |