fairvis.export¶
Export of an assessment as one figure, e.g. for a manuscript.
The figure is rendered by kaleido in a headless Chrome or Chromium, started for each rendering. The shared server of kaleido is not used: it mixes up the results of concurrent calls and blocks if no browser is installed.
EXPORT_FORMATS
module-attribute
¶
EXPORT_FORMATS = {
"png": "image/png",
"jpeg": "image/jpeg",
"svg": "image/svg+xml",
"pdf": "application/pdf",
}
Formats of the export with their MIME type.
WIDTH
module-attribute
¶
Width of the exported figure in px, the unit of the vector formats.
SCALE
module-attribute
¶
Scale of the raster formats: 3000 px wide, 300 dpi at a width of 10 inch.
combined_figure
¶
One figure of an assessment: the bar plot above the polar bar plots.
The figure has one legend of the categories and states the version of fair-ca-visualization and its DOI, so it can be cited.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df_data
|
DataFrame
|
assessment of a model, see |
required |
name
|
str
|
name of the assessed model, shown in the title as text. |
required |
Returns:
| Type | Description |
|---|---|
Figure
|
the figure, sized for the export. |
browser_available
¶
Whether a Chrome or Chromium for the export is installed.
Returns:
| Type | Description |
|---|---|
bool
|
True if kaleido finds a browser, also one installed with |
figure_bytes
¶
Render a figure as a file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fig
|
Figure
|
the figure, e.g. of |
required |
fmt
|
str
|
format of the file, a key of |
required |
Returns:
| Type | Description |
|---|---|
bytes
|
the content of the file. |
Raises:
| Type | Description |
|---|---|
ValueError
|
if the format is not one of |
RuntimeError
|
if no Chrome or Chromium is installed. |